Ragdoll animation

Topics: Developer Forum, User Forum
Apr 10, 2009 at 6:19 PM
Hi there, I made a Ragdoll whose limbs are fixed with angle limit joints. I want to make it walk, and for making it so, I'm modifying during the gametime the legs' angle limit joints (with the same value for max and min angles). The thing is that I'm getting like a "shaking" movement, and I don't know why (see video here: http://www.youtube.com/watch?v=ouL7peG7eAU ). Can anyone help me with this? Any suggestions? Thanks in advance!
Apr 10, 2009 at 6:46 PM
Making an actual walking ragdoll is not an easy task. It will require a lot of tuning and might not end up 100% as you would like it to.

Joints are not 100% stiff and the constant force applied to them (to keep the masses upright) will make it wobble a bit. The more joints, the more wobbling. I'm not sure what you can do to minimize the wobbling other than not use anglejoints for the legs, but move them manually each timestep. There are skeleton animation libraries out there to help you with this.

I would like to see other ideas and suggestions on this.

Apr 10, 2009 at 7:10 PM
Thanks for you answer genbox :) A couple of thoughts:

- By moving the legs manually at each timestep you mean changing their body rotation value? This woulnd't mess up with the physics?
- I'm looking for a skeleton animation library now after reading your comment, maybe using this and activating the physics only when I need it too could be a solution. Does anyone have a suggestion of a library?

More ideas and suggestions would be nice :)
Apr 10, 2009 at 7:46 PM
Moving the legs manually will mess up the physics. Changing their rotation should not be a big problem, but changing their position will be.
Be warned that skeleton animation uses models created in modeling environments to make animations. It is great for creating realistic walking, but might not be the easiest to work with when it comes to 2D physics.
I've only seen one ragdoll (in 2D) that moved by physics. It was made with Box2D and used the revolutejoint motor to move. It might just take a little more fine tuning, who knows.
Stuff like gravity, mass distribution, physicssimulator iterations and timestep all have influence on how your model would behave. Try removing gravity and see if it moves more realistic. Just a thought.
Apr 10, 2009 at 8:37 PM
I'll try to change the rotation manually, but changing the rotation I guess will rotate the body from the body's center and not from the body's border (where the joint is sopposed to be). I'll see how it behaves, I don't want to depend on an additional animation library yet. I'll let you know how it goes :)
Apr 10, 2009 at 10:08 PM
Too bad, manually rotating messes all, it makes weird movements. I'm trying to set the rotation relative to the other limb, so for example if I want to rotate an arm (from its elbow), having two bodies, "arm" and "forearm", and I want to set the angle to 90º I do the following:

float angle1 = arm.Body.Rotation;
float angle2 = MathHelper.ToRadians(90f);
forearm.Body.Rotation = angle1 - angle2;

But that makes it behave very strange. Another option I'm considering is to move the limbs aplying impulses or forces, but I'm not sure...
Oct 31, 2009 at 9:55 AM

@genbox do you have any links to those skeletal libraries?

Nov 2, 2009 at 4:22 PM

Have you tried using stiff FixedAngleSpring?  I don't know if it will be any less wobbly than the angle limit joint, but may be worth a shot.  I think I do remember having trouble when working with angles around 0/360, as it would try to spin all the way around when it crossed that point.  I may be thinking of something else though... For whatever was causing that problem, I was able to easily modify the body code to use -180 to 180 angles, rather than 0 to 360.

Nov 3, 2009 at 7:34 AM

Yep, tried that (anyway, I stopped to work on that project). The problem wasn't on the joint type, the problem was on the rotation point I was using (the center of each limb). Rotating each one of them from joint position would make this work.

Anyway, as soon as I finish my current project, I'll give this another chance, but using motor joints (with RobertDodd's patch on the revolute joint), this should work nicely I think.