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

BodyFactory and Fixtures

Dec 23, 2011 at 3:45 PM

I'm having a real trouble here with working out how body factory actually works. In the documentation it says you need to attach, a body to a world, shape to body and fixture between shape and body.

So if i'm using BodyFactory, it's attached to a world and has a shape which has been set using CreateCircle for example, but how do you access the fixture which i'm guessing in the background assigned the shape to the body? This might be a stupid question and I might just be doing it the wrong way altogether but it's my understanding you need to access the fixture to be able to use collisions?


Some one please enlighten me on this. I hate not been able to work stuff out for myself :P

Dec 24, 2011 at 11:03 AM

A Body is a point in space.

A Shape makes up the second dimension in the form of a polygon.

A Fixture attaches a Body and a Shape together.


In the newest version (3.3.1) of FPE, the BodyFactory creates a body and attaches a shape to it for you. To access the fixture on the body, you simply access Body.FixtureList.

Collisions are automatically calculated when a shape is attached to a body. If you need to know when the body collides with other bodies, you can subscribe to each fixture using the Fixture.OnCollision delegate. Example:

Body.FixtureList[0].OnCollision += MyCollisionHandler;

Dec 27, 2011 at 12:42 AM

Perrrfect. Thanks for the help.