This project has moved and is read-only. For the latest updates, please go here.

Concave Fixtures

Topics: User Forum
Jun 19, 2010 at 6:44 PM

Does FP3 currently know how to work with concave fixtures. I know it can't be concave in the actual simulation so does it know how to cut up the fixtures? For example if I give it a concave fixture, can it cut it to make the fixture convex like so? I think FP2.1.x was able to do this but I'm not sure. Reason I'm asking is because I have concave fixtures in my game and whenever my character touches them, weird things happen. He either gets stuck on the corner right when he touches and then the joints attaching him don't really work anymore. Or he falls apart in a weird manner. I thought this may be the cause. 


Jun 19, 2010 at 8:33 PM

If your using concave polygons you need to run them through a decomposer before using them in the engine. I recommend the EarClip decomposer because it seems a little bit more stable in my experience.

public static System.Collections.Generic.List<Vertices> ConvexPartition(FarseerPhysics.Common.Vertices vertices)
    Member of FarseerPhysics.Common.Decomposition.EarclipDecomposer

Just give it the vertices for your polygon and it will give you back a list of convex polygons that equal the concave one. Then you just need to add each item from the list to body.

I hope this helps. If not let me know whats not working.