Page 1 of 1

Spring-based character physics.

Posted: Mon Mar 21, 2005 6:20 pm
by lodi
(This is somewhat off-topic, so mods please move this around as necessary.)

I'd just like to start a discussion about physics-based animation. This isn't particularly ogre-related, but I thought I'd just kick some ideas around.

I found this thread ( ... ht=ragdoll) that talks about the general idea (second post from the bottom).

So the principle is like this:

* Regular skeleton tied to an ode sphere/capsule and collided against the world as usual (keeps the model above the floor, on the outside of a wall, etc.)
* Ragdoll constructed to resemble skeleton.
* Skeletal animation suggests a per-frame target for ragdoll geoms.
* Ragdoll experiences fairly stiff spring forces to try and align with the precanned animations. In the absence of anything to collide against, ragdoll should look like a plain old skeletal anim (might lag behind a tiny bit and be a little wobbly, but should be okay overall?)

Will this work? In the absence of anything to collide against will this look okay or is there something I'm not taking into account? (Gravity?)

Assuming it's good sofar, the system confers two advantages:

1) You can use a tighter bounding capsule for characters, since the ragdoll automatically won't let arms protrude through walls and such.

2) Character can react to mild forces believably. A shot to the shoulder can be expected to rotate the torso a little, throwing off aim in a believable manner, etc. (Would have to avoid excessive forces to the legs, otherwise the character would look like he's floating while his legs struggle to realign themselves).

And the final feature would be like this:

* Sufficiently large variations in the 'torso' geom would feed back into the overall translation/rotation of the model.

So shooting directly at the chest would knock the whole body back a bit (feet sliding back, but nothing worse than what you normally have in games), and rotate the head/shoulders slightly backwards as the torso geom recoils.


Posted: Tue Mar 22, 2005 1:30 am
by eyevee99
Are you basically saying you want to blend ragdoll like physics with animation?

Posted: Tue Mar 22, 2005 4:08 am
by Kojack
I haven't tried it myself yet (although I will when I get a chance), but it should work. There are some cool possibilities too like getting shot in the arm could disable the constraints tying your arm argdoll to the animated skeleton, so your arm flops around like it's broken as you run around. Turn off all the constraints and your character becomes a true ragdoll. Or turn off the leg and torso constraints so you go partial ragdoll, but your arms and head continue to animate (like a wounded enemy waving for surrender or trying to crawl away, but still using ragdoll).

The main problem is if part of your body gets stuck on something, your ragdoll body could be left behind. But that could be handled by checking the error factor between ragdoll and animated skeleton and popping bones back into place if they get too far away.

Posted: Tue Mar 22, 2005 11:00 am
by Sputnick
I tried similar concepts. It's working.
The main problem is the shaky aspect of spring model if not damped.
If the spring factor is too small, your ragdoll won't follow your skeleton animation and if is it too large, your model will shake.

The other issue is I guess the time consumption for collisions. Do you need collistions all the time on the entire ragdoll ?
Physics demos are nice, but there are usally a few things to collide on and nothing else to compute which is not the case in a game.

Anyway, my next project will be focused on automatic generation of skeleton animation based on some goals and rules. I shall try the spring model idea.

- Sput

Posted: Tue Mar 22, 2005 11:15 pm
by T.T.H.
Sputnick wrote:I shall try the spring model idea.
/me blushes

If you get anything going (or not) with it, please drop me a line.


Posted: Wed Mar 23, 2005 2:12 am
by lodi

It gives me much confidence to hear that someone already went and (successfully) did it! Keep us posted on your project.