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

FP3 ragdoll joint

Sep 22, 2010 at 3:32 AM

Using FP2.x I had good luck creating joints for a ragdoll using RevoluteJoints with an AngleSpring. This worked pretty well, as you can see here -

I'm not sure how to replicate this using FP3? So far I have a RevoluteJoint with MotorEnabled, but the joints are too stiff (they don't spring back to a target angle).

Anyone have any ideas on how to replicate a joint with springiness for a ragdoll type joint?


Sep 22, 2010 at 9:16 AM

Wow, nice ragdoll. Probably one of the best I've seen so far. Is the code for it public?

If you want springiness, try a joint where you can set it's frequency and demping.

Sep 22, 2010 at 1:10 PM

After hunting around a bit more, I found some info on the AngleJoint. This is very close to what I was looking for, but I can't seem to make it have the springiness or bounce of the FP2.x implementation. If anyone has hints on that please let me know.

The ragdoll demo I posted about is part of the Physics Helper demos. I am trying to port the Physics Helper to FP3.


Sep 22, 2010 at 1:47 PM

Andy, you can kind of make the angle joint mimick an angle spring, by adjusting the Softness and Bias factor. For example, here are the softness and bias factors for the shoulder joint of Krashlander:

        float shoulderSoftness = .00001f;
        float shoulderBiasFactor = .1f;

Alternatively, you could try to us something like the following from the Box2D manual. This snippet of code uses the revolute joint motor to mimic and angle joint.

float32 angleError = myJoint->GetJointAngle() - angleTarget;

float32 gain = 0.1f;

myJoint->SetMotorSpeed(-gain * angleError);

Finally, you might just look at the angle spring code from the old Farseer source and try to port it to the new engine. I can't imagine it's too complicated.  Haven't looked at it, though.