Animal Locomotion in Unity 6: Idle, Walk, Run & Jump

A believable animal character is two things at once: clean artistic assets, and state logic that never lets those assets contradict what the body is doing. This guide builds a complete animal locomotion system in Unity 6 — idle, walk, run and jump — around a rigged White-Tailed Deer, the kind of character you would drop into a forest ecosystem simulator or any nature-focused project.

Everything here is deliberately foundational. It is a stepping stone: once you can read an Animator Controller graph and predict exactly which state will play on the next frame, the advanced systems — procedural gaits, foot IK, multi-directional blending — stop looking like magic. Start here, then scale up.

What you will build

  • A one-dimensional Blend Tree that fades idle → walk → run from a single Speed value.
  • A three-clip jump arc (take-off, airborne, landing) driven by a trigger and a ground check.
  • A camera-relative C# controller, so “forward” always means “away from the camera”.
  • A working Cinemachine orbit camera that follows the animal across the terrain.

Time needed: about 30 minutes. You need Unity 6, the free deer asset linked further down (or any rigged quadruped with idle, walk, run and jump clips), and no previous state-machine experience.

The tools of the trade

Three Unity 6 systems carry the whole setup, and each one has a job the other two should never do:

  • Animator Controller: the state machine. It decides which clip plays, using parameters such as Speed and isGrounded. It never decides where the character is.
  • Character Controller + C#: the movement. It decides where the body goes, then reports that motion back to the Animator as plain numbers. This is the only component allowed to move the transform.
  • Cinemachine FreeLook camera: the view. It orbits the animal and, crucially, supplies the rotation that the movement code steers against.

Keeping those three responsibilities separate is the one habit that prevents the classic beginner bugs: skating feet, a character that animates but never moves, or a jump that fires twice.

Step 1: Setting up the Animator Controller

These are the clips the state machine switches between. Every one of them is an in-place animation — the deer walks and runs on the spot, and the script supplies the actual displacement.

The jump is split into three separate clips instead of one long animation. That is what lets the airborne pose hold for exactly as long as the deer is actually in the air, rather than landing on a fixed frame number.

1) Create the controller. Right-click in your Project window → Create > Animator Controller. Name it PlayerAnimator, then drag it into the Controller slot of the deer’s Animator component.

2) Add the parameters. Open the Animator window and create these three animation parameters. Spelling and capitalisation have to match the script exactly — Unity looks them up by string, and a typo fails silently.

ParameterTypeQuestion it answers
SpeedFloatHow fast is the animal moving?
isGroundedBoolAre the hooves touching the ground?
JumpTriggerWas the jump key just pressed?

3) Build the locomotion Blend Tree (idle / walk / run). A Blend Tree is a single state that cross-fades several clips, instead of three states hard-cutting between each other. That is what makes a gait change read as acceleration rather than a jump cut.

  • Right-click in the grid → Create State > From New Blend Tree. Name it Locomotion and make sure it is the default (orange) state.
  • Double-click the Blend Tree. Leave Blend Type on 1D and set the Parameter to Speed.
  • Add three Motion fields:
    • idle (Threshold: 0)
    • walk (Threshold: 1)
    • run (Threshold: 2)
  • Uncheck Automate Thresholds so Unity keeps your 0 / 1 / 2 values, and confirm that all three clips have Loop Time enabled in their animation clip import settings.

Those thresholds are simply labels that the script agrees to use: 0 means idle, 1 means walking, 2 means running. Drag the preview slider left and right to test it — if the deer pops instead of easing between gaits, the clips are out of phase with each other, not mis-configured.

4) Create the jump states. Drag the jump start, jump fall and jump end clips into the Animator grid, then wire the four transitions below. Read the chain out loud: it is a loop that always comes home.

  • Locomotion → jump start: condition Jump (Trigger). Uncheck Has Exit Time so the take-off fires the instant the key is pressed, and shorten Transition Duration to roughly 0.05.
  • jump start → jump fall: Has Exit Time, no condition. The take-off simply finishes and hands over.
  • jump fall → jump end: condition isGrounded = true, no exit time. Physics decides when this happens, not the clip length.
  • jump end → Locomotion: Has Exit Time. The landing plays out and the animal returns to the Blend Tree.

That is the whole grammar of animation state machines: timed hand-offs use exit time, world events use conditions. Mixing the two up is why jumps get stuck mid-air.


Step 2: The C# movement script

This script drives the Character Controller component and calculates movement relative to the Cinemachine / Main Camera rotation, so “forward” is always the direction the camera is looking. Create a script called PlayerController and paste it in.

using UnityEngine;

public class PlayerController : MonoBehaviour
{
    public CharacterController controller;
    public Animator animator;
    public Transform cam;

    [Header("Movement Settings")]
    public float walkSpeed = 2f;
    public float runSpeed = 5f;
    public float gravity = -9.81f;
    public float jumpHeight = 1.5f;
    public float turnSmoothTime = 0.1f;
    float turnSmoothVelocity;

    [Header("Physics Check")]
    Vector3 velocity;
    bool isGrounded;

    void Update()
    {
        // 1. Ground Check
        isGrounded = controller.isGrounded;
        if (isGrounded && velocity.y < 0)
        {
            velocity.y = -2f;
        }
        animator.SetBool("isGrounded", isGrounded);

        // 2. Movement Input
        float horizontal = Input.GetAxisRaw("Horizontal");
        float vertical = Input.GetAxisRaw("Vertical");
        Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized;

        if (direction.magnitude >= 0.1f)
        {
            // Calculate rotation based on Camera
            float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg + cam.eulerAngles.y;
            float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
            transform.rotation = Quaternion.Euler(0f, angle, 0f);

            Vector3 moveDir = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;

            // Determine if running
            bool isRunning = Input.GetKey(KeyCode.LeftShift);
            float currentSpeed = isRunning ? runSpeed : walkSpeed;

            controller.Move(moveDir.normalized * currentSpeed * Time.deltaTime);

            // Update Animator Speed (0=Idle, 1=Walk, 2=Run)
            float animSpeed = isRunning ? 2f : 1f;
            animator.SetFloat("Speed", animSpeed, 0.1f, Time.deltaTime);
        }
        else
        {
            animator.SetFloat("Speed", 0f, 0.1f, Time.deltaTime);
        }

        // 3. Jumping
        if (Input.GetButtonDown("Jump") && isGrounded)
        {
            velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
            animator.SetTrigger("Jump");
        }

        // 4. Gravity
        velocity.y += gravity * Time.deltaTime;
        controller.Move(velocity * Time.deltaTime);
    }
}

How the script works, block by block

  1. Ground check. controller.isGrounded is read once per frame and pushed straight into the Animator with SetBool. The small -2f downward velocity is not a hack: it keeps the capsule pressed into the ground so isGrounded does not flicker on slopes and steps.
  2. Camera-relative steering. Mathf.Atan2 converts the raw input vector into an angle, and the camera’s own Y rotation is added on top, which is what makes “up” on the keyboard mean “away from the camera”. Mathf.SmoothDampAngle then eases the deer into that heading over turnSmoothTime instead of snapping — raise it to about 0.2 for a heavier animal, lower it to 0.05 for something twitchy.
  3. Speed hand-off. The body moves at walkSpeed or runSpeed in metres per second, but the Animator is told 1 or 2 — the Blend Tree thresholds. The fourth argument of SetFloat is a damp time, so the parameter glides to its new value over 0.1 s and the gait change is a blend rather than a switch.
  4. Jump and gravity. Mathf.Sqrt(jumpHeight * -2f * gravity) is the launch velocity that reaches exactly jumpHeight metres, so you can tune the jump in real units. SetTrigger fires the animation while the physics does the arc, and the final Move call applies accumulated gravity.

⚠ Unity 6 input warning: this script uses the classic Input Manager (Input.GetAxisRaw, Input.GetButtonDown). Several Unity 6 templates ship with the Input System package active instead, and then those calls throw InvalidOperationException at runtime. Fix it in Edit > Project Settings > Player > Active Input Handling by choosing Both.

Step 3: Final setup in Unity

  1. Component check: the deer object needs a Character Controller, an Animator and the PlayerController script. Size the Character Controller capsule to the animal — for a white-tailed deer, roughly 0.4 radius and 1.5 height, with the Center lifted to half the height so the capsule sits on the hooves rather than sinking through them.
  2. Assign the references:
    • Drag the Main Camera (the one Cinemachine drives) into the Cam slot of the script.
    • Drag the PlayerAnimator controller into the Animator component, and the Animator and Character Controller into their own script slots.
  3. Turn off Apply Root Motion on the Animator component. The clips are in place and the script owns the movement; leaving root motion on makes the animation and the Character Controller fight each other, which shows up as drift, stutter or a deer that walks away from its own collider.
  4. Check the rig type: a quadruped is not a humanoid. In the FBX import settings, the Rig tab should be set to Generic, never Humanoid — Unity’s humanoid retargeting expects two legs and will mangle a deer skeleton. If you are building the skeleton yourself, my guide to rigging animals with Blender Rigify covers the quadruped side of that workflow.
  5. Cinemachine: set the Follow and Look At targets of your FreeLook camera to the player transform, or to a bone such as the neck for a tighter shot. In Cinemachine 3 (the version that ships with Unity 6) FreeLook is no longer its own component: you add a CinemachineCamera with Orbital Follow plus a FreeLook Modifier. The script does not care which version you use — it only reads cam.eulerAngles.y.

💡 Pro tip: open the jump fall clip’s import settings and enable Loop Time. The airborne pose then holds for as long as the deer is in the air, whether that is a hop off a rock or a long drop down a ravine. Without it, a high jump freezes on the last frame.

Troubleshooting: the four failures everyone hits

  • The deer animates but never moves. Nothing is calling CharacterController.Move — usually because the controller field is empty in the Inspector, or because Apply Root Motion is still on and the clips are in place.
  • The feet skate. The Speed value and the real metres per second disagree. Either slow walkSpeed and runSpeed down to match the stride of your clips, or adjust each clip’s playback Speed in the Blend Tree until the hooves stop sliding.
  • The jump plays but never lands. isGrounded is never becoming true again. Check that the terrain actually has a collider, and that the Character Controller’s Skin Width is about 10% of its radius — too small and the capsule chatters, too large and it hovers.
  • The jump fires twice, or fires late. The Jump trigger is queueing up. Make sure Has Exit Time is unchecked on the Locomotion → jump start transition, and call animator.ResetTrigger("Jump") on landing if a stale trigger is still getting through.

🦄 Free asset: animated White-Tailed Deer

I built this 3D white-tailed deer specifically for Unity 6. It ships with a full rig and the four baked animations used in this tutorial — idle, walk, run and jump — so you can wire up the Animator Controller above without modelling anything first.

Download on GitHub: 3D-Model-White-Tailed-Deer-Animated License: Creative Commons Attribution 4.0 International

Want a second animal to test the same graph on? The free animated giraffe pack ships with its own idle, walk and run clips and drops straight into the Blend Tree you just built.

💡 Looking for a simpler setup? If your project has no jumping, start with the ground-only version of this system: Simplest Animal Locomotion: Idle, Walk and Run in Unity. It strips out the air states entirely and gets your animal moving in a few minutes.

Frequently asked questions

Why does my animal not move when I press W in Unity 6?

Nine times out of ten it is the input backend. If the project was created with the Input System package active, Input.GetAxisRaw throws an exception and movement never runs. Set Project Settings > Player > Active Input Handling to Both. If input is fine, check that the controller, animator and cam fields are all assigned in the Inspector.

Should I use root motion for animal locomotion?

Not for this setup. Root motion is excellent when the animation itself should dictate displacement — a scripted charge, a turn-in-place, a cinematic. For player-driven movement through a Character Controller, keep the clips in place, turn root motion off, and let the code own the position.

Should a deer rig be Humanoid or Generic?

Generic, always. Unity’s Humanoid avatar maps a two-legged skeleton and cannot describe a quadruped spine and four legs. Generic keeps the bone hierarchy exactly as it was authored in Blender, which is what you want for an animal.

Can I add a gallop or a trot later?

Yes, and that is the advantage of the Blend Tree. Add a fourth motion at threshold 3 and have the script pass 3f for that gait. Nothing else in the graph changes — this is exactly why the system is worth building as a state machine rather than as a pile of if statements. Before you animate the new gait, study the footfall order in my ultimate horse reference for animators: walk, trot, canter and gallop differ in beat pattern, not just in speed.

Does this work with Cinemachine 3 in Unity 6?

It does. In Cinemachine 3 the FreeLook rig became a CinemachineCamera with an Orbital Follow component and a FreeLook Modifier, but the script only ever reads the Main Camera’s Y rotation, so both versions behave identically.


Where this leads next

The configuration you just built is a basic setup, and that is the point of it. Idle, walk, run and jump, moved by two parameters and a trigger, is the smallest complete system that still behaves like a real creature — small enough to hold in your head, complete enough to ship in a prototype.

State-of-the-art animal locomotion is the same skeleton with more layers on top. Procedural gait adjustment changes the Blend Tree input instead of the clips. Foot IK corrects the pose the state machine produced. Multi-directional strafing swaps the 1D tree for a 2D one on two parameters. Dynamic weight shifting rides on Animator layers and avatar masks. Every one of those techniques assumes you already know which state is playing, why, and what will end it — which is precisely what you now have with this deer.

The natural next step is to replace the keyboard with a brain: feed Speed from a navigation agent or an ML-Agents policy instead of Input.GetAxisRaw, and the same Animator Controller drives an autonomous animal in an ecosystem simulation without a single change to the graph.

Deciding which creature to rig next? The animator’s menagerie: top 10 land animals for mastering creature animation ranks them by what each one teaches you, and mastering the 3D animation production pipeline covers everything that happens before the FBX reaches Unity.