![]() | Procedural Animation |
This page discusses recommendations for using different procedural animation techniques.
Ragdoll Workshop supports a variety of procedural animation techniques on top of the standard physics-based animation provided. There are different recommended approaches depending upon the effect you are trying to accomplish.
The hierarchy of a RagdollAnimator is just an input source for the Ragdoll bound to it. It functions like a control rig in a 3D animation package—it contains only the primary skeleton. While many forms of secondary animation typically take place in the LateUpdate() loop, it is important they are applied to the proper hierarchies and are timed correctly when being used with Ragdoll Workshop.
Any procedural animation evaluated at run-time for the purpose of aiding in character deformation (e.g., helper joints) is most easily handled by including it only in the Ragdoll hierarchy, NOT in the RagdollAnimator hierarchy. Such joints only handle secondary deformation, and they branch off the primary skeleton hierarchy, rather then splicing it. Please see the constraints on the included characters for an example.
Procedural animation applied to the primary skeleton, which is normally evaluated in e.g., Update()/LateUpdate(), can subscribe to the OnPreprocessAnimatedHierarchy and/or OnPostprocessInputPose events. The former occurs right before animation is sampled for the frame, and the latter occurs right before Animator data is applied to the ragdoll. See the included RagdollAnimatorFinalIKSync script for an example.
RagdollParts can be controlled by physics at all times if there is no corresponding part mapped in the RagdollAnimator (e.g., arbitrary chains for tails, hair, etc.). When including such parts, you should take care that animation data cannot inadvertently put them into invalid locations (e.g., inside of the ground collider) or they could explode. In such cases, you may be able to mitigate these effects by enabling projection on the bodies' joints. Alternatively, you can include these parts in your RagdollAnimator definition and control them using animation data during sensitive sequences, re-adding weight to a layer with a RagdollState when you want physics to resume. See the included Arbitrary Chains scene for an example.