I'm trying to make a character rotate in the right direction so that when the character gets up from a ragdoll state, the animation would closely match the initial lay down position of the ragdoll.
The character has a third person controller and when I move it around, it rotates according to the directions from the joystick. So when it falls it usually gets up in the right direction but sometimes, when the character falls from a cliff, the animation doesnt match the ragdoll orientation.
I'm using this method to calculate whether the hips are pointing upward or downward so I can trigger the right animation.
wasRootBoneFacingUpward = Vector3.Dot(bones.forward, Vector3.down) < 0;
How can I rotate my character so that it fits the body alignment of the ragdoll ?