Page 1 of 1

Ragdoll problems

Posted: Fri Oct 26, 2007 9:48 am
by X-0ut
Got a little problem concerning ragdoll.
Firstly I'll explain that I have separate 'limbs' each connected with pivot joints.
This is like sticking pins through paper cutouts of body parts.
It works to a point, but theres no limitation on how much each limb can rotate in comparison with its parent 'limb', this results in some horrendous looking positions.

Any idea's welcome.

Re: Ragdoll problems

Posted: Fri Oct 26, 2007 11:04 am
by slembcke
Need angular constraints. The math isn't terribly complicated for that if you want to give it a shot. You'd have to understand how the clamping works in the impulse solver though.

The other option is to use distance constraints. Not ideal, but it would work OK-ish.

Angular (and several other kinds of) constraints are on my list for what that's worth.

Re: Ragdoll problems

Posted: Sat Oct 27, 2007 3:12 am
by lucas
Correct me if I'm wrong, but I thought many ragdoll games don't have angular constraints.

Re: Ragdoll problems

Posted: Sat Oct 27, 2007 9:20 am
by X-0ut
There must be some kind of constraint, otherwise some funky looking poses happen. Impossible ones even.
For example, when you bend your knee the greatest arc it can make is roughly 0-88 degrees, it cant do a 360 :)

I've poked around the code a little, and don't really understand whats going on, math is not a strong point of mine.
Possibly I will give the pin joint constraint a try, failing that I'll remove the ragdoll completely because it really does look weird heh.

Oh and one more thing, I found a cpGrooveJoint which is un-documented, what does that do?

Re: Ragdoll problems

Posted: Sat Oct 27, 2007 11:34 am
by slembcke
Well, the easiest solution would be to just use slide joints.

Using the arm as an example, you would attach two slide joints. Use the first to set a minimum distance between the wrist and shoulder. The second you'll want to attach behind the elbow. It's hard to explain in words, but see the attached picture. Basically you are preventing the two points behind the elbow from getting too close, thus preventing from bending backwards.

Re: Ragdoll problems

Posted: Sat Oct 27, 2007 5:51 pm
by X-0ut
Thanks for the great example, it made a big difference!