Converting Box2D Flash Ragdoll Demo

Topics: User Forum
Dec 20, 2009 at 10:10 PM
Edited Dec 20, 2009 at 10:33 PM

Here's the demo: http://box2dflash.sourceforge.net/.

I'm reading through the Actionscript file they have and am making decent progress. I think I got all the bodies set up no problem. They all seem a bit too small, so maybe Box2D does something different with sizes? Not sure. But I'm really having issues with the joints. They're using a b2RevoluteJointDef to create joints which seems to be the same as the JointFactory.Instance.CreateRevoluteJoint, however they are also able to set angle limits. For instance, here's them linking the head to the body:

 

// JOINTS
jd.enableLimit = true;

// Head to shoulders
jd.lowerAngle = -40 / (180 / Math.PI);
jd.upperAngle = 40 / (180 / Math.PI);
jd.Initialize(torso1, head, new b2Vec2(startX / m_physScale, (startY + 15) / m_physScale));
m_world.CreateJoint(jd);

 

Is the revolute joint what I want to connect the ragdoll pieces? Or is there a better joint I should be using to link everything up and get the effect of their demo? Also if anyone has advice on the bodies or perhaps can whip up a quick port of the demo to Farseer, that'd be fantastic. :)