Setting Up Procedural Animation in Games
Key animation is good for predictable movements. But a character climbing stairs of unknown height, reaching object at arbitrary space point or reacting to uneven terrain—this is procedural animation task. Mixing both approaches in one character—standard for modern gameplay.
Foot IK as Entry Point to Procedural Animation
Foot IK is most common case and good illustration of principle. Key animation walk cycle assumes flat surface. On ramp character feet "sink" through geometry or hang in air. Foot IK corrects this in real-time: raycast down from each ankle, bone position adjusted to hit point, Two Bone IK recalculates knee.
In Unity Animation Rigging this is implemented through Two Bone IK Constraint component. Chain: Thigh → Shin → Foot. IK Target is empty Transform, position managed by script. Hint is another Transform defining knee bend direction (Pole Vector). Without properly set Hint knee bends to random side when moving IK Target.
Script logic: Physics.Raycast from foot position (plus small offset upward) downward on LayerMask = Ground. On hit—move IK Target to hit.point, rotate by hit.normal for correct foot angle. Constraint Weight—0 during swing phase (foot in air), smooth lerp to 1 during stance.
Hip Offset problem: when both feet placed at different heights (one slope) Hip-bone must lower proportionally, otherwise IK chain can't reach goal. Calculated from height difference of two IK Targets and applied as offset to Hip position through Body Position Rig Constraint or directly through animator.bodyPosition.
Procedural Look-At and Aiming
Multi-Aim Constraint in Animation Rigging—head and eyes track target. Setup: Source Object = target (enemy, interactive object), Aim Axis = Forward (Z for Unity). Constrained Axes—only Y and X, don't touch Z (otherwise neck twists). Weight controlled dynamically: 0 in combat, 0.6–1.0 exploring environment.
For weapon aiming: Two Bone IK on right arm, IK Target follows CrosshairTarget in world space. Shoulder and elbow recalculate automatically. Blend between key aiming animation and procedural IK—through Rig Layer Weight.
Limitation: Animation Rigging works in LateUpdate after Animator. This means procedural constraints apply above key animation every frame. With complex constraint hierarchy (head → neck → shoulder → arm) Rig layer order is critical—order violation gives "one-frame lag" effect.
Spring Systems for Secondary Motion
Hair, cape, antennae—elements not hand-animated in production project with normal budget. Options in Unity:
Magica Cloth 2—GPU-accelerated cloth simulation, supports Wind Zone, colliders, distance constraints. Setup through component on mesh with Skinned Mesh Renderer, Bone Cloth or Mesh Cloth depending on geometry.
Dynamic Bone (legacy but still used)—Spring simulation along bone chain. Parameters Stiffness, Elasticity, Damping tuned per chain. Colliders for body intersection prevention—Sphere, Capsule.
VRM Spring Bone from UniVRM—standard for VRM avatars, integrates well with Humanoid Avatar.
For AAA quality on PC—Physical Component from Houdini Rigging exported to Unity, but separate pipeline.
Procedural Animation in Unreal: For Comparison
In Unreal Engine, Control Rig with Full Body IK solves same tasks as Animation Rigging in Unity. PBIK (Position-Based IK) in UE5 gives full-body IK from single solver—no standard Unity equivalent, only third-party solutions like Final IK. If project on Unreal—pipeline differs but principles same: animation layers, IK above key clips, spring for secondary motion.
Typical Errors
IK without normalized bone chain. Two Bone IK works incorrectly if sum of two bone lengths less than distance to IK Target—sink doesn't reach position and freezes in extended state. Either add small raycast target error (offset above surface) or limit IK work zone.
Procedural animation without Physics Layer Separation. If Spring Bone bones included in Animator State—they interfere with key animation. Spring-bones must be outside Humanoid Avatar, only in Generic hierarchy under main skeleton.
Update in FixedUpdate instead of LateUpdate. Physics raycast for Foot IK computed in FixedUpdate—correct. But application to bones must be in LateUpdate after Animator.Update, otherwise Animator overwrites changes.
Timeline
| Task | Estimated Duration |
|---|---|
| Foot IK for one character | 1 to 2 days |
| Full Body IK with Look-At and Foot IK | 3 to 5 days |
| Spring system for secondary motion | 1 to 3 days |
| Procedural interaction animation with environment | 3 to 7 days |
Cost determined after analyzing existing rig and platform requirements. Mobile platforms with Physics limitation—separate discussion.





