Skip to main content
‹ Back to Tutorials
Intermediate Unity

Unity 3rd Person - Animation Rigging Package for head look

May 16, 2022
About this tutorial

In this Unity 3rd Person tutorial, I'll be showing how to use the Unity Animation Rigging package to override the character animation so that I can have the head and upper body face in the direction the camera is looking. ► Download Playmaker at https://bit.ly/3dV8JzC ► Download Unity at https://un

Written Guide

Default character animations rarely point the head where the player is actually looking. Unity's Animation Rigging package solves this by letting you override specific bones at runtime, so the head and upper body can track a target independently of the underlying animation clip. This guide walks through building a head-aim rig that follows your free-look camera.

Install the Animation Rigging package

Open Window > Package Manager and switch the source to Unity Registry. Search for "rigging" and install the Animation Rigging package if you haven't already. Once it finishes installing you can close the Package Manager window. This package is what lets you take the existing animation on your character and override one of its bones with a constraint-driven target.

Set up the bone renderer and rig

Select the player model game object that has your Animator attached. With it selected, go to Animation Rigging and add a Bone Renderer Setup, which lets you see and select the bones in your animation. Still on the model, add a Rig Setup. This creates a Rig 1 object that may spawn at an odd position, so reset its transform to 0, 0, 0 so it sits correctly at the character's feet as part of the model.

Create the head-aim Multi-Aim Constraint

Inside Rig 1, add an empty game object named Head Aim and add a Multi-Aim Constraint component to it. Drag the head bone from your animation into the Constrained Object field so the constraint knows which bone to override. Check the aim axis and up axis against that bone: for this model the aim axis is Z (pointing out in front) and the up axis is Y (the green arrow). Set these to match whatever bone you're driving.

Add a look target and effector

Under the Source Objects list, click plus to add a slot, then create an empty game object called Head Target inside Head Aim. Position it in front of the character, around Z = 2 and Y = 1.5 so it sits near eye level. With Head Target selected, use the Animation Rigging menu to add a Local Effector, choosing the Ball Effector mesh so you can see the target in the Scene view (it won't appear in the game). Drag Head Target into the Multi-Aim Constraint's source object. Now pressing Play and moving the target left and right swings the head with it. You can also preview this without playing by enabling Preview in the Animation window.

Constrain rotation and add upper-body movement

Out of the box the head can rotate a full 360 degrees, which breaks the neck. On the Multi-Aim Constraint, limit each axis from roughly -90 to 90 for a natural range. To make movement more lifelike, add another empty game object in Rig 1 called Upper Body Aim with its own Multi-Aim Constraint. Set its weight to about 0.75 so the torso moves less than the head, drag the spine (or spine 1) bone into the Constrained Object, use the same Head Target as its source, and limit it to about -70 to 70.

Drive the target with the free-look camera

To make the character look wherever the camera looks, open your cameras and make Head Target a child of the main camera that your free-look Cinemachine rig controls. Reset its transform, then push it out in front by setting Z to about 10. Now when you play and move the free-look camera, the head and upper body continuously point in the camera's direction.

Unity tools by Bliz Studio
Built for our own games — now on the Asset Store

Multi Tag — unlimited hierarchical tags for any GameObject. Hierarchy Pro — style your whole hierarchy with rules. Made by a Unity dev, for Unity devs.

Explore our Unity assets →