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?
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.