# Farseer Physics: Ways to create a Body?

I want to create something similar to this using farsser and Kinect:

https://vimeo.com/33500649

This is my implementation until now:

I have the outline vertices and the triangulation of the user. And following the Texture to Polygonmsample i used this line to create the shape, where farseerObject is a list of vertices of the triangles:

_compound = BodyFactory.CreateCompoundPolygon(World, farseerObject, 1f, BodyType.Dynamic);

But I have to update the body each frame (like 30 fps) and this is very slow. I get just 2 or 3 fps.

There's another (faster) way to create the Body from a list of triangles or the contour vertices?

How do you think they do this on Box2D?

# Update:

After some testings i used EdgeShapes for the user contour (without triangulation) and i update the vertices for that edges in the fixtures every frame, now all is faster.

((EdgeShape)(farseerBody.FixtureList[i].Shape)).Vertex1 = new Vector2(farseerVertices[i].X, farseerVertices[i].Y);


But the collisions does not work!

My approach is incorrect?

• Are you creating the whole thing every frame? Might be running a little slow if you create huge amounts of garbage perhaps? In that case just try to recycle the same objects instead. – Mikael Högström Sep 3 '12 at 17:42
• Do you see the video? The user contour is created every frame, so the vertices are differents. There are some Body type that I can recycle? <br/> This is another example in Box2D youtube.com/watch?v=BPWKx3KAvTI – EdgarT Sep 3 '12 at 19:50
• Until i know, farseer physics is "based" on box2d. There must be a way to do this. I feel that i missing something obvious or not? – EdgarT Sep 3 '12 at 19:59
• why you need to triangulate if you are just using the overall shape? – user827992 Sep 3 '12 at 20:11
• Because the object needs to be convex, or not? I did a test using the ear clipping algorithm and a get up to 10fps, not much better... – EdgarT Sep 3 '12 at 20:18

 LoopShape loopShape = new LoopShape(farseerVertices);