How to apply forces to a Fixture within a Body?

Topics: User Forum
Apr 22, 2011 at 6:26 AM

Hey guys, long time Farseer 2 user.. just upgrading to 3 and trying to figure things out.

In Farseer 2 we had a player that used the typical "box on a circle" setup where the "torso" area is a rectangle body, and the "feet" are actually a circle body.  These were connected by a joint to keep it upright, and in order to move the player around, we just applied torque forces to the circle.

So I'm trying to set this up in Farseer 3 now, but I'd like to take advantage of being able to attach multiple fixtures to a single body.  Basically, I'd like the entire player to be a single body, which has two fixtures: the torso rectangle, and the feet circle.

This is done and works.

The problem:  How do I apply a torque force to the circle?  It is a fixture.  Applying torque to the body affects both the rectangle and circle.  This is not desired.

Is it possible, or do I need to go back to having two separate bodies making up the player?  It just seems so messy that way, and an awful waste of the ability to have multiple fixtures on a single body.

 

Thanks

Developer
Apr 22, 2011 at 9:32 AM

You need to have two separate bodies if you want to have them respond to forces & torques independently. Fixtures are best thought of as something defining the shape and surface materials of something (primarily for collision detection), and bodies are what deals with the dynamics. These two classes have very different responsibilities which is why the code is set up this way.