Implementing ragdoll recovery

Hi, all!

As I see people are implementing it I wonder how to do it.

Per book it is done like this - we have a number of animations and have skeleton with bones set by ragdoll.
We remove/disable ragdoll from bones leaving transform intact and the looking for best matching animation
which is most close to current ragdoll position, then setting the desired animation to playback and enabling
animations for bones.

The question is - how can I find best matching animation? is there some way to look-up bone positions in
animations without playing them?


Studying Lumak’s thread and video:

I’m not a specialist here, but it seems to me that his video shows like two standing animations, selected by torso bone transform (facedown/faceup).

But how to slowly transform curent pose to first frame of animation? It is quite fluent doing that…
@Lumak please tell us the truth!

It seems to me that he explained exactly that.

or maybe I misunderstood, but I’m not specialist here. If there are questions, maybe he will be kind enough to elaborate on his technique there.

Well, is it possible to do all that without c++ trickery?
I just wonder how can I access animation transforms directly to do some magic… that would solve everything…

It’s exactly that. Changes to AnimatedModel and AnimationController classes are required.

C++ classes mentioned above are required.

@Lumak thanks a lot for explanation.

Maybe you know, is it possible to get access to animation’s transforms for more elaborate solution
to algorithmically select best-fit animation?

Anim xforms won’t help you. Instead, you’ll have to know before hand what animation would work best. Algorithm I use is to compare the character’s rigidbody capsule orientation or its forward direction, via GetDirection(), and compare that to the ragdoll’s head node direction from the hip node. If the two are in the same direction, I use getupfromFront animation, otherwise use getupfromBack anim. Of course you can add more getup animations, such as getupfromRight and getupfromLeft, and make it more elegant.

Thanks a lot for your sharing, will look into this as next task.