Animation-Driven Locomotion
Represent durable movement modes as States while keeping Animator updates and movement work in focused Actions. This prevents animation parameters, navigation, and physical movement from competing for ownership.
Build the graph
- Add
Idle,Move,Jump, andLandStates appropriate to the controller. - In Idle and Move, use Actions that update the Animator values required by the project’s controller.
- Let the existing movement owner—Character Controller, NavMeshAgent, Rigidbody, or project motor—apply translation.
- Put input, grounded, speed, and completion checks on transitions as Conditions.
- Use Jump and Land only when those are durable modes with distinct entry, update, or completion behavior.
How it runs
State Designer selects the locomotion mode. Actions translate authoritative movement data into Animator parameters and request work from the movement system. The Animator presents the result; it does not become a second decision system unless root motion intentionally owns translation.
The Animation Sync sample converts NavMeshAgent velocity into the float parameter expected by its sample Animator Controller. A production controller needs a matching script or Actions for its own parameter names and blend-tree structure.
Key choices
- Use one movement authority. Do not move the Transform directly while a Rigidbody, Character Controller, or NavMeshAgent also owns it.
- Decide explicitly whether root motion or code supplies position and rotation.
- Keep short animation clips inside a durable State only when their completion controls the transition.
- Use Shared Variables for speed, grounded state, or requested direction when both Actions and Conditions need the same authoritative values.
Verify in Play Mode
Move from idle to locomotion, jump or trigger another transient mode, then return to idle. Confirm that the active State, Animator parameters, visible clip, and physical movement agree throughout the cycle. Stop one movement input and verify that no second system continues moving the object.
Troubleshooting
| Symptom | Check | Fix |
|---|---|---|
| Animation changes but the object does not move. | Movement authority and root-motion choice. | Supply movement through the configured controller or enable the intended root motion. |
| The object jitters or moves twice. | Competing Transform, Rigidbody, NavMeshAgent, and root-motion paths. | Keep one translation owner and let the graph request rather than duplicate movement. |
| The State and animation disagree. | Parameter update order and transition inputs. | Derive both from the same authoritative movement data. |