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

Inherit rotation angle of body linked with RevoluteJoint

Sep 19, 2009 at 3:30 PM


I've been searching for hours on end on how to achieve this using Farseer:

I want to link 2 bodies using a RevoluteJoint (and the angle of BodyB beeing limited by a FixedAngleLimit joint), and have the BodyB rotate when BodyA is rotated, BUT it should also keep its local rotation angle.

It's probably difficult to explain in text, so I've made a pretty picture to detail my issue:

(Farseer Body edges in pink, RevoluteJoint in cyan)


As you would have guess it's for a ragdoll... The RevoluteJoint Anchors are correctly rotated alongside the root body, but the angle of the RevoluteJoint remains unaffected by the root's rotation!

Does anyone know how could I get the local limb's rotation to be rotated relative to the root body? I can't use an AngleJoint between the Root (limbA) and the Limb (limbB), because then the angle would always be fixed, which then prevents local rotation of a limb (ex: tilting the arm to the left by 30 degrees)

If the arm is tilted by 30deg locally, then the root is rotated by 45deg, the final rotation of the arm should be 75deg.



Sep 20, 2009 at 12:47 AM

I've finally found my answer (thanks to Ragath on IRC!)

What I needed was the RevoluteJoint + an AngleLimitJoint (instead of the fixed ones I had been using). Now the ragdoll behaves more realistically, and looks rad in game :)

I guess this post might help some people in the future, as ragdolls seem to become quite the trend!

Sep 20, 2009 at 6:51 AM

Would you be able to post any of your physics code for how you got it to work?
This code could be added to the ragdoll sample that comes with farseer.

Anyway cool looking character.

Sep 23, 2009 at 9:56 AM

Well it is literally just bodies linked with the root body using a revolution and an AngleLimit joint each, it's quite simple, and different from the pin joint method of the ragdoll sample.

Here's a video footage of the ragdoll in my game: :)