Ragdoll problems

Official forum for the Chipmunk2D Physics Library.
Post Reply
X-0ut
Posts: 28
Joined: Tue Oct 02, 2007 5:02 am
Contact:

Ragdoll problems

Post 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.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Ragdoll problems

Post 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.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
lucas
Posts: 54
Joined: Wed Sep 26, 2007 2:34 am
Contact:

Re: Ragdoll problems

Post by lucas »

Correct me if I'm wrong, but I thought many ragdoll games don't have angular constraints.
Tangame - a tangram puzzle game with physics.
http://code.google.com/p/tangame/
X-0ut
Posts: 28
Joined: Tue Oct 02, 2007 5:02 am
Contact:

Re: Ragdoll problems

Post 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?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Ragdoll problems

Post 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.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
X-0ut
Posts: 28
Joined: Tue Oct 02, 2007 5:02 am
Contact:

Re: Ragdoll problems

Post by X-0ut »

Thanks for the great example, it made a big difference!
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests