Location of shapes relative to body.

Topics: Developer Forum
Jan 17, 2011 at 5:25 PM

I am creating a set of connected polygon shapes with associated bodies and fixtures.

I create each polygon in the same coordinate system (i.e. all have same origin, each body has position of zero) and each shape is not center around zero.

Each shape is connected with a distance joint.

When I step, things move in unpredictable ways (no gravity or forces).

My question is what is the ramifications of each shape no being not centered around zero or is it really required to create each shape centered around zero and set the body position to correct location?

Is there any torque issues?


Jim K.

Jan 18, 2011 at 8:22 PM

Do the shapes overlap?

Could you be without the distance joint and use a single body with multiple fixtures instead?

How are they moving without any forces or gravity?

Jan 19, 2011 at 2:43 AM

The shapes do not overlap, no I can't use a single shape. What I a creating is similar to the ragdoll.   At this point they should not be moving. There is no gravity and I have applied on forces, yet.  I am in the middle of testing.

I do have more information since I made this post.  Some how it related to my use of joints.  While I think I have the correct placement of the anchors (I am verifying) I think it must be either this or some combination of the placement of the anchors along with the placement of the vertices all being place using absolute coordinate frame of reference.

I have generated plots of the vertices and they are correct.

When I removed the joints there was no motion as is expected.

With the joints the bodies move to strange locations separated by a great distance.




Jim K.

Jan 19, 2011 at 4:40 PM

The distance joint length is the same length as the length between the initial anchors. Unless you change it.

If you create a bunch of distance joints and don't apply force to the bodies - it should not move at all. I've demonstrated this as seen in the spiderweb demo inside the AdvancedSamples (to be included in 3.3 - it is in the source control at the moment).

You have scaled your world to use the MKS system right?

Jan 20, 2011 at 1:43 AM

For everyone,

I did find the cause and it was my setting the length to an inappropriate value and was different than the initial separation.  This caused the bodies to move apart to meet the length specification.

I have it working now, I just have to figure out the correct way to apply forces for my simulation.


BTW, Thanks genbox for helping and developing Farseer.  I wanted to thank you for all the hard work and think you have done a great job.  I hope you continue to provide this great software and continue to improve a great package.


Jim K.