JV-ODE Physics Thread 9

Blitz3D Forums/Blitz3D Userlibs/JV-ODE Physics Thread 9

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

That's funny, both you guys are talking what I've been messing around with for the last two weeks :) Although with limited success to be honest...

@OBD: Yes, you can create a ragdoll setup. And switch between two modes:
1. Animation Mode: Where the bone-animation DRIVES the ode rigid bodies (so you have animation + proper collision detection)
2. Ragdoll Mode: Where you let the ODE simulator drive the rigid bodies - that in turn drive the bones.

When a character is walking you'll have it in Animation Mode, when it get's shot or clubbed on the head you detect that foreign collision and switch to ragdoll mode so the character collapses or is blown over..

But as JA2 mentioned, once you want your collapsed ragdoll to go back to animation mode, you'll have to reset all the rigid bodies and joint positions to match a model's "current state".
Setting the rigid bodies is easy (just position+rotate them equal to the bones), but I also have serious trouble re-setting a joint's axis when a model has been rotated, etc.
ESPECIALLY ""trying"" to restore the axis at such an angle that it's original lo/hi stop values are correct again!
And that's the thing I don't seem to be able to tackle. Too much math for my limited brain I guess..

Let's take a knee-joint (hinge) for example. The Thigh and Shin bones are at a certain angle from each other (in their default pose). The joint axis is in Global coordinates - as are the Lo/Hi stop values.
BUT as soon as you Attach a joint, it keeps the two rigid bodies 'relative' to their initial angles...

So if I set up a rig from default pose, that's no problem.
But if I want to re-rig it whilst the character is lying on the floor in a heap for example, I haven't got a clue how to deal with this.... (too many angles, objects, vectors vs eulers, etc.)
Does anyone understand what I'm saying here?! :) Let alone possibly have some hints?!

thanks,
D.