# Procedural Animation and IK Keyframed clips tell a character *what* to do. Procedural animation makes the result fit the world the character is actually standing in: feet that land on the step instead of hovering over it, a head that turns toward the noise, legs that find footholds on their own, and a body that falls with physics when it is hit hard and then gets back up without a pop. This series builds those four layers on top of the existing animation notes: - [[Animation]] already covers Animator fundamentals, and [[5.Animation Rigging and Script IK]] introduces `RigBuilder`, `Rig`, `TwoBoneIKConstraint`, `MultiAimConstraint` and classic `OnAnimatorIK` hand IK. [[6.Worked Example Locomotion Look-At and Hand IK]] puts a basic look-at and hand IK on a humanoid. - [[Animation Advanced]] covers layers, avatar masks, root motion, `MatchTarget`, sub-state machines and animation events. **This series does not repeat those.** It assumes you can already add a Rig and a constraint, and goes into the parts those notes leave out: grounding, choosing look targets, procedural locomotion, and ragdoll blending. Part 1 has the exact overlap table. **Target:** Unity **6000.5+**, **Animation Rigging 1.4.1** (`com.unity.animation.rigging`; the 6000.5 package page lists 1.4.1 as the released version, checked 2026-11-20), built-in 3D physics (PhysX), a Humanoid character for parts 2, 3 and 5 (any Mixamo-style rig works) and a generic multi-legged rig for part 4. Filed under **Systems and Architecture** in [[Unity Tutorials]]. > [!warning] Code not compiled > **None of the C# in this series has been compiled or run in Unity.** Scripts were written against the 6000.5 Scripting Reference and the Animation Rigging 1.4 API pages listed in Sources. Expect to fix small compile errors and to tune every number on your own rig. > [!note] Verification status > **Verified (docs, 2026-11-20):** Animation Rigging 1.4.1 is the released version for 6000.5 and the 1.4 docs say it is compatible with 2023.2 and later; `TwoBoneIKConstraintData` (`root`, `mid`, `tip`, `target`, `hint`, `targetPositionWeight`, `targetRotationWeight`, `hintWeight`, `maintainTargetPositionOffset`); `MultiAimConstraintData` (`constrainedObject`, `sourceObjects` as `WeightedTransformArray`, `aimAxis`, `upAxis`, `worldUpType`, `limits` as a `Vector2` in degrees, `offset`, `maintainOffset`); `WeightedTransform(Transform, float)`; `DampedTransformData` (`dampPosition`, `dampRotation`, where 0 follows and 1 does not move); `RigBuilder.Build()`. Mecanim: `MonoBehaviour.OnAnimatorIK`, `Animator.GetIKPosition`, `Animator.bodyPosition` (world space, "only set this value from within an OnAnimatorIK() function call"), `Animator.leftFeetBottomHeight`, `Animator.GetBoneTransform` (throws if the avatar is missing or not Humanoid), curves on imported clips driving Animator parameters. Physics: the Ragdoll Wizard is at **GameObject > 3D Object > Ragdoll...**; `Rigidbody.AddForceAtPosition`; `Rigidbody.linearVelocity`; Character Joint. > **(unverified):** the exact frame order between `RigBuilder` evaluation and `OnAnimatorIK` when both run on one Animator (part 1 explains why these notes keep them on separate jobs); whether `HumanBodyBones.UpperChest` is mapped on your rig (many rigs leave it empty); default joint limits the Ragdoll Wizard creates in 6000.5. ## Parts | # | Note | What you build | |---|---|---| | 1 | [[1. Procedural Animation Pipeline and Overlap]] | Frame order (Animator, IK pass, Rig, LateUpdate, physics), which existing note covers what, choosing Mecanim IK vs Animation Rigging | | 2 | [[2. Foot IK and Ground Alignment]] | `HumanoidFootIK` (OnAnimatorIK, pelvis drop, slope rotation, lift preservation) and `RigFootPlanter` for generic rigs | | 3 | [[3. Look-At Interest Targets and Aim Chains]] | `LookAtInterest` + `LookAtDirector`: scored targets, one proxy target, spine/neck/head MultiAim chain with limits | | 4 | [[4. Procedural Stepping and Secondary Motion]] | `ProceduralLegStepper` gait groups, `ProceduralBodyAdjuster`, Damped Transform tails and antennae | | 5 | [[5. Ragdoll Setup and Blending]] | Ragdoll Wizard, layers, `RagdollController` with impulse knockdown, root re-alignment and pose-blended get-up | | 6 | [[6. Worked Example Grounded Guard with Knockdown]] | One guard that plants its feet, watches the player, and gets knocked down by a heavy hit from the Combat Feel pipeline | | 7 | [[7. Procedural Animation Pitfalls]] | Jitter, double IK, ragdoll explosions, get-up pops, cost | ## Architecture at a glance ``` Update Gameplay: movement, LookAtDirector picks a target, stepper decides steps Animator update State machine + clips evaluate the pose IK pass HumanoidFootIK.OnAnimatorIK (pelvis drop + foot goals) [Humanoid, Mecanim] Rig jobs RigBuilder: MultiAim chain, TwoBoneIK legs, DampedTransform [Animation Rigging] LateUpdate RagdollController get-up blend overwrites bones for ~0.5 s FixedUpdate Ragdoll rigidbodies (when active) drive bones instead of the Animator ``` ## Design lens (Level Up!) - **Level 5 - Character:** Rogers asks you to design how a character moves before what it looks like. Grounded feet and a head that tracks interest are what make a character read as *aware* of its world; a hovering foot reads as a bug even to non-developers. - **Level 10 - The Elements of Combat:** a heavy hit should look heavy. The ragdoll knockdown in part 5 is the payoff end of [[Combat Feel and Hit Feedback]]; it is the "big finish" for a combo. - **Level 11 - Enemies:** an enemy's head turning toward a noise is a *telegraph*. Part 3's look-at driven by [[Organic Enemy Sensing]] gives the player readable information about what the guard noticed before it attacks. - See [[Level Up! (Review)]]. ## Patterns used (Game Programming Patterns) - **Component** - foot IK, look-at, stepping and ragdoll are separate components that can be added or removed per character. - **Observer** - `LookAtInterest` objects register themselves; the director never searches the scene. Ragdoll listens for a knockdown event, it does not poll health. - **State** - the ragdoll controller is a small state machine (Animated, Ragdoll, GettingUp); the stepper legs are Planted or Stepping. - **Update Method** - each system runs in a known phase of the frame (part 1 table) instead of "somewhere in Update". - See [[Game Programming Patterns (Review)]]. ## Related (existing) - [[Animation]], [[5.Animation Rigging and Script IK]], [[6.Worked Example Locomotion Look-At and Hand IK]], [[7.Animation Pitfalls]] - [[Animation Advanced]], [[3.Root Motion Advanced]], [[4.MatchTarget CrossFade Rebind OverrideController]], [[6.Animation Events Reliable Patterns]] - [[Physics 3D]], [[4. Joints]], [[5. Forces FixedUpdate and Motion Modes]], [[3. Layers Matrix and Queries]] - [[Character Controllers]], [[3. CharacterController Implementation]] - [[Combat Feel and Hit Feedback]], [[4. Hit-Stop Knockback and Feedback]] - [[Organic Enemy Sensing]], [[Enemy AI State Machine]] - [[Haptics and Controller Rumble]] - rumble on the same heavy hit that triggers the ragdoll - [[Profiling and Optimization]] - measuring rig and ragdoll cost ## Sources - Animation Rigging 1.4 manual: https://docs.unity3d.com/Packages/[email protected]/manual/index.html - Animation Rigging on 6000.5 (released version 1.4.1): https://docs.unity.com/en-us/engine/6000.5/manual/packages-list/packages-all/pack-safe/com-unity-animation-rigging - `TwoBoneIKConstraintData`: https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.Animations.Rigging.TwoBoneIKConstraintData.html - `MultiAimConstraintData`: https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.Animations.Rigging.MultiAimConstraintData.html - `WeightedTransform`: https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.Animations.Rigging.WeightedTransform.html - Damped Transform constraint: https://docs.unity3d.com/Packages/[email protected]/manual/constraints/DampedTransform.html - `RigBuilder`: https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.Animations.Rigging.RigBuilder.html - `MonoBehaviour.OnAnimatorIK` (6000.5): https://docs.unity.com/en-us/engine/6000.5/script-reference/unityengine/monobehaviour/onanimatorik - `Animator.GetIKPosition` (6000.5): https://docs.unity.com/en-us/engine/6000.5/script-reference/unityengine/animator/getikposition - `Animator.bodyPosition` (6000.5): https://docs.unity.com/en-us/engine/6000.5/script-reference/unityengine/animator/bodyposition - `Animator.leftFeetBottomHeight` (6000.5): https://docs.unity.com/en-us/engine/6000.5/script-reference/unityengine/animator/leftfeetbottomheight - `Animator.GetBoneTransform` (6000.5): https://docs.unity.com/en-us/engine/6000.5/script-reference/unityengine/animator/getbonetransform - Curves on imported clips (6000.5): https://docs.unity.com/en-us/engine/6000.5/manual/animation-section/animation-mecanim/animation-clips/animation-curves-on-imported-clips - Create a ragdoll (6000.5): https://docs.unity.com/en-us/engine/6000.5/manual/physics-section/physics-overview/ragdoll/wizard-ragdoll-wizard - Character Joint (6000.5): https://docs.unity.com/en-us/engine/6000.5/manual/physics-section/physics-overview/joints-section/class-character-joint - `Rigidbody.AddForceAtPosition` (6000.5): https://docs.unity.com/en-us/engine/6000.5/script-reference/unityengine/rigidbody/addforceatposition