Body shape

Topics: User Forum
Jan 4, 2011 at 6:57 AM
Edited Jan 4, 2011 at 7:30 AM

Being new to Farseer, I've a simple question:

If the geometry is handling the collisions, why does the body has to have a shape? I would assume it holds the physics parameters and a collection of geometries.

That being said, I understand the body needs the MOI for its computations, but I assume it comes from the shapes of the attached geometries, so I don't see the point of the shape for the body itself.

Can someone explain?

Developer
Jan 4, 2011 at 8:57 AM

Sounds like you are using Farseer 2.x?

If you are new to Farseer and you are just starting out might I suggest you take the newest version (3.2)? It has quite a lot of breaking changes but also much more features and there really is now reason to use 2.x anymore, if you start a new project.

thomasdjafari wrote:

That being said, I understand the body needs the MOI for its computations, but I assume it comes from the shapes of the attached geometries, so I don't see the point of the shape for the body itself.

I think in Farseer 2.x that was different, therefore you had to provide a body shape. In 3.2 it is exactly as you say though and a body's MOI, mass, etc. is calculated from the shapes/fixtures attached to a body.

Jan 5, 2011 at 4:27 PM

Right, I did an update. I think I figured out now: I create a body and then the fixture factory to attach the shape. Is that correct?

Developer
Jan 6, 2011 at 7:28 PM

Indeed it is :)

Some factory methods even take care of the body creation for you, so just be careful about what is created where.