Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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?


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?

share|improve this question
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 – 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
up vote 3 down vote accepted

Finally works!

I had the vertices of the contour as a sequence, so the solution was use the LoopShape to create the fixture of the body. I did not even know that Class =P

 LoopShape loopShape = new LoopShape(farseerVertices);
 //Delete the previous fixture
 //Create new fixture with the new contour

And that's all!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.