Implementing Aim Offsets for Weapon Targeting
In this lesson, you will learn how to build an Aim Offset asset to make your character’s upper body realistically track a dynamic target while they move.
When a character holds a weapon, their spine and head need to pitch (look up/down) and yaw (look left/right) to align with where the player is aiming. Instead of creating hundreds of individual animations for every possible angle, we use an Aim Offset. This is a special type of Blend Space that stores additive animations—poses that represent the "difference" between the base idle pose and the look-at pose.
Setting Up the Asset
To create an Aim Offset, right-click in your Content Browser, go to Animation, and select Aim Offset. You will be prompted to select your character's Skeleton.
Once opened, you need to define two parameters in the axis settings:
- Pitch: Usually ranges from -90 to 90 degrees.
- Yaw: Usually ranges from -90 to 90 degrees.
Inside the grid, you will drag and drop your additive animations. You should have nine poses for a standard setup: Center, Up, Down, Left, Right, and the diagonal combinations (Up-Left, Up-Right, Down-Left, Down-Right). Because these are Additive, they only contain the rotation data for the spine, neck, and head bones, ensuring the character’s legs remain unaffected by the aiming logic.
Applying the Logic
Inside your AnimGraph, you don't use a standard Blend Space. Instead, use the Aim Offset node. This node requires you to feed in your Pitch and Yaw variables (calculated from the difference between the character’s forward vector and the camera/target look-at direction).
// Logic flow inside the AnimGraph
// 1. Calculate LookAt rotation
// 2. Pass Yaw and Pitch to the Aim Offset node
// 3. Blend the result with your main locomotion pose
By connecting the output of this node to your Layered Blend Per Bone or directly into your pose chain, the character will now fluidly pivot their torso to face the target, providing that professional, responsive feel to your weapon targeting.
Key Takeaway: Aim Offsets use additive poses mapped to a 2D grid to procedurally rotate the upper body, allowing your character to look at targets dynamically without needing a unique animation for every angle.