# Aim Weapon

The **Aim Weapon** node points a weapon muzzle at a target location and then adjusts the supporting arms to follow. It pairs well with [Apply Spray To Target](apply-spray-to-target.md) when you want the weapon to visibly follow a burst pattern.

If your project fires from the animated muzzle, this node helps keep that muzzle lined up. If your project fires from a separate camera or gameplay trace, this node can still keep the weapon pose matching that direction.

![Aim Weapon node](_media/aim-weapon-node.png ':size=1200')

## Usage

1. Add the **Aim Weapon** node to your Control Rig graph
2. Connect a target position in <span class="fr-term" tabindex="0" data-tooltip-key="global-space">global space</span> to **Target**
3. If the detected setup is not right, right-click the node and pick another Quick Setup from the dropdown, or edit [Muzzle Adjustment](#muzzle-adjustment) and [Arm Adjustment](#arm-adjustment) manually
4. If the character can switch weapons, set up [Weapon Analysis](#weapon-analysis) so one Aim Weapon setup works for all of them

## Quick Setup

When you place the node, FocalRig generates any [Quick Setups](quick-setups.md) it can detect for the current hierarchy and auto-applies the first one. If another one matches your rig better, right-click the node and choose it from the Quick Setup dropdown. Each entry names the element, perspective, and hand configuration, such as `Quick Setup: Aim muzzle, first person, right hand`. Entries for `muzzle` elements appear first.

<details>
<summary>How detection works</summary>

Quick Setup builds presets from the hierarchy in a few stages:

- It looks for arm chains named like `upperarm` / `upper_arm` / `shoulder` / `humerus` → `lowerarm` / `lower_arm` / `forearm` / `elbow` / `radius` / `ulna` → `hand` / `wrist`
- It looks for muzzle-like elements named `muzzle`, `barrel`, `gun`, `bow`, `arrow`, `weapon`, or `hand`, checking bones first and then nulls. Hand sockets such as `HandGrip_R` show up as nulls, and their names contain `hand`, so they are offered too
- For each matching muzzle-like element, it walks up the hierarchy to find which detected arm owns it and offers a one-arm preset for that setup
- If multiple arms are available, it also offers a multi-arm preset that keeps the primary weapon-holding arm first in the pivot list
- For [Aim Down Sights](#aim-down-sights) it tries to find a POV-style bone (`pov`, `camera`, `view`, or `eyes`), otherwise a same-side eye bone, and finally falls back to `head`. Eye bones are found the same way as in [Aim Eyes](aim-eyes.md?id=quick-setup): `eye` has to be a word of its own, as in `FACIAL_L_Eye` or `eye_l` but not `EyesackUpper` or `EyeCornerInner`.
- If the rig has an `ik_hand_gun` bone that is neither under a hand nor above the arms, it fills [Copy Hand To Weapon IK Bone](#copy-hand-to-weapon-ik-bone) with the hand holding the weapon and `ik_hand_gun`
- For each arm, it fills [Reference Element](#arm-settings) with the matching IK hand bone (e.g. `ik_hand_l` for `hand_l`), leaving **Reference Weight** at 0
- For each arm, it fills [Clavicle](#clavicle) with the parent of the arm's Root Bone if it is named like `clavicle`, `collar`, or `shoulder`. It sets **Shoulder Contact Radius** to the upper arm's thickness in the preview mesh's physics asset plus 5 cm (or to the clavicle's length if the upper arm has no physics body), and **Reach Start Distance** to 95% of the arm's length
- Every detected weapon and arm combination produces a third-person preset
- If a POV bone exists, the same combination also produces a first-person preset. It uses the POV as the pivot and eye, selects **Pivot** as the rotation smoothing frame, enables [**Pose Override**](#pose-override) relative to the POV, and chooses the closest common ancestor of the POV and dominant hand as the [**Aim Lock Motion Reference**](#aim-lock-motion-reference)

</details>

If your hierarchy does not have recognizable arm chains or any muzzle-like element, Quick Setup will not offer a usable preset. In that case, fill [**Muzzle**](#muzzle) manually, then add the supporting arms under [**Arm Settings**](#arm-settings).

## Setting Up the Muzzle

Aim Weapon needs to know where the muzzle is. How you set this up depends on the weapon.

If the weapon is a separate actor attached to a hand socket, such as `HandGrip_R`, you don't need a muzzle element. Set **Muzzle > Element** to the socket, and **Muzzle > Offset** to the muzzle's position relative to the socket. [Weapon Analysis](#weapon-analysis) can do this for you. Then you only need to pick the Quick Setup for the socket, such as `Quick Setup: Aim HandGrip_R, first person, two-handed`.

If the weapon mesh is part of the character mesh, create a bone or null under the weapon's attach bone and place it at the barrel tip. If you want Quick Setup to find it automatically, name it `muzzle`, `barrel`, `gun`, `bow`, `arrow`, `weapon`, or `hand`. `muzzle` is the clearest choice.

Quick Setup searches bones first, then nulls. Once it finds a candidate, it chooses the muzzle's forward axis by snapping to the local ±X/±Y/±Z axis closest to the direction from the pivot shoulder to the muzzle in the preview pose. That is why the preview pose should show the weapon pointing forward.

If Quick Setup still picks the wrong muzzle or wrong arm, right-click the node and choose a different Quick Setup preset from the dropdown. If none of them are right, fill **Muzzle Adjustment > Muzzle** and **Arm Adjustment > Arms** manually.

?> Before 1.8.0, a weapon actor needed a muzzle element in the rig, moved into place with a **Set Relative Transform** node. This still works, but **Muzzle > Offset** now does the same with no extra element or node.

## Weapon Analysis

Weapon Analysis makes it easy to set up one Animation Blueprint and one Control Rig to handle many weapons, instead of making a separate one for each weapon and configuring things like the muzzle transform manually.

The [Analyze Weapon](analyze-weapon.md) Blueprint function automatically finds each weapon's muzzle, sights, and stock from sockets on the weapon mesh, and figures out how to hold the weapon in front of the first-person camera. To use the result, connect the equipped weapon's analysis to Aim Weapon's **Weapon Analysis** pin and enable **Override With Weapon Analysis**. The analysis then overrides the [weapon-specific settings](#overridden-settings) on the node.

![Switching weapons with Weapon Analysis](_media/weapon-switching.mp4 ':type=video autoplay loop muted playsinline')

### Example Setup

This is how the video above is set up, with weapon actors attached to a hand socket:

1. Add sockets to each weapon mesh: `Muzzle` at the end of the barrel, `FrontSights` and `RearSights` on the sights, and `Stock` at the back of the stock. Only `Muzzle` is required. See [Sockets](analyze-weapon.md?id=sockets).
2. In the weapon Blueprint's construction script, call **Analyze Weapon** on the weapon's skeletal mesh component and store the result in a variable.

   ![Analyze Weapon in a weapon's construction script](_media/analyze-weapon-construction-script.png ':size=1000')

3. Attach the weapon actor to a hand socket, such as `HandGrip_R`, with no offset. The actor's origin is where the hand holds the weapon.
4. In the Control Rig, add a public **Focal Rig Weapon Analysis** variable. In the Animation Blueprint, set it to the equipped weapon's analysis with <span class="fr-term" tabindex="0" data-tooltip-key="property-access">Property Access</span>.
5. Right-click Aim Weapon and pick the Quick Setup for the hand socket, such as `Quick Setup: Aim HandGrip_R, first person, two-handed`.
6. Connect the variable to **Weapon Analysis** and enable **Override With Weapon Analysis**.

![Aim Weapon with the Weapon Analysis variable connected and Override With Weapon Analysis enabled](_media/aim-weapon-weapon-analysis.png ':size=1200')

The Control Rig editor preview has no weapon, so it uses the default analysis. This matches Aim Weapon's own defaults.

In any setup, the analysis is relative to the actor that owns the weapon mesh. So set **Muzzle > Element** to the rig element at that actor's origin.

### Overridden Settings

While **Override With Weapon Analysis** is enabled, the analysis sets the settings below. All other settings keep their values from the node, so you still control e.g. when to aim down sights.

| Aim Weapon setting | Set from the analysis to |
|--------------------|--------------------------|
| Muzzle > Offset | The muzzle's position relative to the weapon actor. So **Muzzle > Element** must be the element at the weapon actor's origin, such as the socket it is attached to |
| Muzzle > Local Axis | X, the barrel direction |
| Pose Override > Muzzle Offset From Reference | How to hold the weapon in front of the camera in first person. See [First Person Hold](analyze-weapon.md?id=first-person-hold) |
| Aim Down Sights > Sights Offset From Muzzle | The front sights |
| Aim Down Sights > Rear Sights Offset | The rear sights, or zero if the weapon only has one sights socket |
| Aim Down Sights > Weight | 0, but only for weapons without sights sockets |
| Body Depenetration > Contact Points | The `Stock` sockets, or the rear of the mesh bounds if there are none. The shoulders also follow these (see [Clavicle](#clavicle)) |

## Input Pins

| Pin | Type | Description |
|-----|------|-------------|
| Target | Vector | Location to aim at in <span class="fr-term" tabindex="0" data-tooltip-key="global-space">global space</span> |
| Override With Weapon Analysis | bool | When enabled, [Weapon Analysis](#weapon-analysis) overrides the weapon-specific settings |
| Weapon Analysis | Focal Rig Weapon Analysis | The result of [Analyze Weapon](analyze-weapon.md) for the equipped weapon |
| Muzzle Adjustment | [Muzzle Adjustment Settings](#muzzle-adjustment) | Settings for weapon muzzle placement and orientation |
| Arm Adjustment | [Arm Adjustment Settings](#arm-adjustment) | Settings for adjusting the arms holding the weapon |
| Debug | [Debug Settings](#debug-draw) | Debug visualization settings |
| Weight | float | The blend weight of this operation (0.0 = no effect, 1.0 = full effect) |

Setting the node's **Weight** to 0 resets its muzzle solver state, including smoothing and bob/sway phase.

### Muzzle Adjustment

Controls which element represents the muzzle, how it rotates toward the target, how far it can move, and how additional effects such as [Aim Down Sights](#aim-down-sights), [canting](#canting), [kick](#kick), [weapon bob](#weapon-bob), [idle sway](#idle-sway), [landing dip](#landing-dip), and [aim lock](#aim-lock-weight) are layered on top.

#### Muzzle

Pick the element that represents the muzzle and the axis that should point at the target. Quick Setup usually fills this from the detected muzzle-like element and the current pose.

For a weapon that is a separate actor, set **Element** to the socket the weapon is attached to (e.g. `HandGrip_R`), and **Offset** to the muzzle's position relative to it. See [Setting Up the Muzzle](#setting-up-the-muzzle).

See [Aim Element](aim-element.md) for the full property breakdown.

#### Pose Override

Overrides the weapon's starting pose before the aiming pipeline. This is mainly useful in first-person rigs where the animation pose does not already place the weapon where you want it.

![Pose override comparison](_media/weapon-pose-override-comparison.mp4 ':type=video autoplay loop muted playsinline')

| Property | Type | Description |
|----------|------|-------------|
| Reference Bone | Rig Element Key | The reference element used for the override, typically the POV or camera element. If unset, the offset is treated as <span class="fr-term" tabindex="0" data-tooltip-key="global-space">global space</span> |
| Muzzle Offset From Reference | Transform | Desired muzzle transform relative to **Reference Bone** (or in <span class="fr-term" tabindex="0" data-tooltip-key="global-space">global space</span> if unset). X is the direction the muzzle aims (see [Aim Mode](aim-element.md?id=aim-mode)). Overridden by [Weapon Analysis](#weapon-analysis) |
| Weight | float | 0 = use the animation pose, 1 = use the override pose |

#### Muzzle Distance

Constrains and smooths muzzle distance relative to the pivot.

This is most visible when you walk into nearby walls or cover. With sensible **Min Distance To Target** and **Min Distance To Pivot** values, the weapon pulls back and the supporting hand follows instead of clipping into the surface.

| Property | Type | Description |
|----------|------|-------------|
| Min Distance To Pivot | float (cm) | Minimum distance from muzzle to pivot to prevent arm collapse |
| Min Distance To Target | float (cm) | Minimum distance from muzzle to target. Targets closer than this are pushed away |
| Smoothing | [Smoothing Settings](smoothing.md) | Spring smoothing for the constrained distance |

#### Pivot Rotation

Aim Weapon rotates the muzzle around a pivot to aim at the target.

| Property | Type | Description |
|----------|------|-------------|
| Pivots | list of Rig Element Keys | Aim Weapon averages these elements' locations to find the pivot point. It uses the first element's rotation for clamping |
| Clamp | [Rotation Clamp Settings](rotation-clamping.md) | Settings for clamping pivot rotation |
| Smoothing Frame | [Smoothing Frame](#smoothing-frame) | Rotations of this frame are followed immediately without smoothing. |
| Custom Smoothing Frame | Rotation | When Smoothing Frame is **Custom**, changes to this rotation in <span class="fr-term" tabindex="0" data-tooltip-key="global-space">global space</span> are followed immediately without smoothing. |
| Smoothing | [Smoothing Settings](smoothing.md) | Spring smoothing for the pivot rotation |

Use the clamp to prevent breaking the arms when the target is too far off to the side.

##### Smoothing Frame

This setting is useful to prevent the weapon from wobbling off target due to root offset, turn-in-place animations, etc.

It determines a reference frame whose rotations the weapon follows immediately without smoothing. For example, in the Root Bone mode, if the root bone has rotated by some amount since the last frame, the weapon will also rotate by the same amount without delay.

The **Control Rotation** smoothing frame is useful for third-person player characters. It allows the weapon to follow the player's aim directly without being disturbed by root offset or turn-in-place animations. This is better than no smoothing at all as it lets the weapon adjust smoothly when the target distance changes abruptly. For example, when aiming past a wall:

![Third person smoothing frame comparison](_media/third-person-smoothing-frame-comparison.mp4 ':type=video autoplay loop muted playsinline')

The **Pivot** smoothing frame is useful for first-person players where the pivot is the POV/camera.

![First person smoothing frame comparison](_media/pivot-smoothing-frame-comparison.mp4 ':type=video autoplay loop muted playsinline')

Here is the full list of smoothing frames and when to use them.

| Smoothing Frame | What the weapon follows immediately | When to choose it |
|-----------------|--------------------------------------|-------------------|
| **Root Bone** | The root bone's rotation. | **NPCs**. This is the default. |
| **Pivot** | The first pivot element's rotation | **First-person players** where the pivot is the POV/camera. First-person Quick Setup selects this. |
| **Control Rotation** | The pawn's control rotation. Uses **Root Bone** if the pawn has no controller | **Third-person players**, especially when using Root Offset |
| **Custom** | The **Custom Smoothing Frame** input in <span class="fr-term" tabindex="0" data-tooltip-key="global-space">global space</span> | Non-standard setup where you need maximum control. |

#### Aim Down Sights

When enabled, positions the weapon so the sights align with the line from the eye to the target.

![Aim down sights comparison](_media/weapon-ads-comparison.mp4 ':type=video autoplay loop muted playsinline')

| Property | Type | Description |
|----------|------|-------------|
| Weight | float | Blends between regular aiming (0.0) and ADS mode (1.0). Set to 0 by [Weapon Analysis](#weapon-analysis) for weapons without sights |
| Blend Out During Aim Lock | bool | Multiplies **Weight** by 1 minus [Aim Lock Weight](#aim-lock-weight). On by default. See [Blend Out During Aim Lock](#blend-out-during-aim-lock) |
| Eye Source | [Eye Source](#eye-source) | Where to get the eye position from |
| Eye | Rig Element Key | The eye element to align sights with when **Eye Source** is **Element** |
| Eye Location | Vector | The eye location to use when **Eye Source** is **Transform** |
| Sights Offset From Muzzle | Vector | Offset from the muzzle to the front sights in muzzle space. Overridden by [Weapon Analysis](#weapon-analysis) |
| Rear Sights Offset | Vector | Offset from the front sights to the rear sights in muzzle space. Overridden by [Weapon Analysis](#weapon-analysis) |
| Rotation Around Sights Smoothing | [Smoothing Settings](smoothing.md) | Spring smoothing for the additional rotation around the sights |

##### Blend Out During Aim Lock

This option automatically blends out ADS out while [Aim Lock](#aim-lock-weight) is on by multiplying the ADS **Weight** by 1 minus **Aim Lock Weight**. This way weapon reloading animations play as intended instead being distorted by having the ADS offset preserved throughout the animation.

![Reload during Aim Lock with Blend Out During Aim Lock off and on](_media/ads-blend-out-during-aim-lock-comparison.mp4 ':type=video autoplay loop muted playsinline')

Turn this off to keep ADS during Aim Lock (e.g., so a custom recoil animation comes through better on the screen).

##### Eye Source

| Value | Description |
|-------|-------------|
| **Element** | Use an element from the rig hierarchy as the eye position |
| **Transform** | Use a fixed eye location in <span class="fr-term" tabindex="0" data-tooltip-key="global-space">global space</span> |

#### Straighten

Corrects muzzle roll by aligning the muzzle's up axis with a chosen up vector.

Uses the same smoothing and clamping as [Pivot Rotation](#pivot-rotation).

![Weapon straighten comparison](_media/weapon-straighten-comparison.mp4 ':type=video autoplay loop muted playsinline')

| Property | Type | Description |
|----------|------|-------------|
| Weight | float | Blend weight for straightening (0.0 = no effect, 1.0 = full effect) |
| Up Vector | Vector | The direction in <span class="fr-term" tabindex="0" data-tooltip-key="global-space">global space</span> to align the muzzle's up axis with |

#### Canting

Rolls the weapon as the character moves sideways or turns the aim, giving it a sense of weight without disturbing where it aims. You can also supply a **Manual Angle**, for example to tilt the weapon when a button is held.

Canting is enabled by default and works after [Straighten](#straighten).

Uses the same smoothing and clamping as [Pivot Rotation](#pivot-rotation).

**Angle Per Lateral Speed** controls how much the weapon tilts when moving left or right. It measures the root bone's movement through world space, including movement from animation and Offset Root Bone. Left and right are relative to the pivot, which is the POV/camera in a first-person setup.

![Weapon canting from movement, off, default, and 4x](_media/weapon-canting-movement-comparison.mp4 ':type=video autoplay loop muted playsinline')

**Angle Per Turn Speed** controls how much the weapon tilts when turning the aim left or right. It follows changes in the intended aiming direction, including the blend into Aim Down Sights.

![Weapon canting from turning, off, default, and 4x](_media/weapon-canting-turning-comparison.mp4 ':type=video autoplay loop muted playsinline')

**Manual Angle** lets gameplay control the cant directly, for example through lean-left and lean-right inputs.

![Manual weapon canting](_media/weapon-canting-manual.mp4 ':type=video autoplay loop muted playsinline')

| Property | Type | Description |
|----------|------|-------------|
| Manual Angle | float (degrees) | Roll added to the automatic canting. Defaults to 0. Positive values tilt right, negative values tilt left |
| Angle Per Lateral Speed | float | Degrees of cant per 100 cm/s of sideways root movement along the pivot's right axis. Defaults to 1. Set to 0 to disable this contribution |
| Angle Per Turn Speed | float | Degrees of cant per 90 degrees/s of aim turning around the pivot's up axis. Defaults to 3. Set to 0 to disable this contribution |
| Max Angle | float (degrees) | Limits the combined manual and automatic cant before Weight is applied. Defaults to 10. Zero or negative means unlimited |
| Clamp Mode | Hard Clamp or Soft Saturation | **Hard Clamp** stops at Max Angle. **Soft Saturation** (default) gradually approaches Max Angle |
| Weight | float | Overall strength. 0 disables canting, 1 is the default, and 4 exaggerates it four times. Negative values reverse the direction |

Positive speed settings tilt toward the movement or turn. Negative settings tilt away. **Manual Angle** and both automatic contributions are added before clamping. 

Note that with **Soft Saturation**, the resulting angle is smaller than the input even below Max Angle. Use **Hard Clamp** or set **Max Angle** to 0 when you want a specific manual angle.

#### Body Depenetration

Pushes the weapon forward just enough to keep the contact points on the weapon outside the character's physics asset (the same one used for hit detection and ragdolling). [Quick Setup](#quick-setup) fills them in with the spine, neck, head bones it detects based on bone name.

![Weapon body depenetration comparison](_media/weapon-body-depenetration-comparison.mp4 ':type=video autoplay loop muted playsinline')

Turn this on if the weapon clips into the character's body when aiming: set **Weight** to 1 and configure one or more **Contact Points** with locations on the gun that tend to clip (e.g., the stock).

Currently supported physics asset body types:

- sphere
- capsule
- box
- convex hull
- tapered capsule (treated as ordinary capsules, this matches engine behavior for ragdoll physics as actual tapered capsules are for clothing only)

| Property | Type | Description |
|----------|------|-------------|
| Contact Points | array of Vector (cm) | Points on the weapon in muzzle local space to keep outside the body. X points forward along the aim axis. Place them slightly beyond the surface for a small clearance margin. The one closest to the shoulder is also the stock the shoulder follows (see [Clavicle](#clavicle)). Overridden by [Weapon Analysis](#weapon-analysis) |
| Depenetration Bones | list of Rig Element Key | Body bones to test against. These should be bones that actually have physics asset collision shapes |
| Max Forward Push | float (cm) | Safety cap for how far the weapon can be pushed. Keep this just large enough to clear normal clipping. <=0 = no limit |
| Smoothing | [Smoothing Settings](smoothing.md) | Smooths the push in and out. Raise this if the weapon clears correctly but the motion feels too snappy or jittery |
| Weight | float | Effect strength. 0 = disabled (default), 1 = full.

#### Kick

Applies an analytical muzzle kick after a shot. If the stock rests on the shoulder, the kick also moves the shoulder back (see [Clavicle](#clavicle)).

![Weapon kick comparison](_media/weapon-kick-comparison.mp4 ':type=video autoplay loop muted playsinline')

| Property | Type | Description |
|----------|------|-------------|
| Time Of Last Shot | double (s) | The world time when the last shot was fired |
| Offset | Vector (cm) | Positional offset of the kick in muzzle space |
| Kick Duration | float (s) | Duration of the kick phase |
| Kick Ease | Easing | Easing function for the kick phase |
| Recovery Duration | float (s) | Duration of the recovery phase |
| Recovery Ease | Easing | Easing function for the recovery phase |

#### Weapon Bob

Adds a procedural locomotion bob to the weapon.

![Weapon bob comparison](_media/weapon-bob-comparison.mp4 ':type=video autoplay loop muted playsinline')

Weapon Bob layers a locomotion-driven bob transform onto the weapon after the main aim solve. That makes the weapon ride with movement without changing what the muzzle is trying to aim at.

See [Bob](bob.md) for the full property breakdown.

#### Idle Sway

Adds subtle multi-axis sway while the character is standing still or moving slowly.

Idle Sway adds subtle breathing and drift to the weapon after aiming so the weapon does not feel perfectly locked while the character is idle.

![Weapon idle sway comparison](_media/weapon-idle-sway-comparison.mp4 ':type=video autoplay loop muted playsinline')

See [Idle Sway](idle-sway.md) for the full property breakdown.

#### Landing Dip

Dips the weapon downward on landing.

Landing Dip adds a short downward impact reaction to the weapon without changing the target the muzzle is trying to face.

![Weapon landing dip comparison](_media/weapon-landing-dip-comparison.mp4 ':type=video autoplay loop muted playsinline')

See [Landing Dip](landing-dip.md) for the full property breakdown.

#### Aim Lock Weight

Aim Lock freezes the current procedural aim adjustment at the moment the weight becomes nonzero, letting recoil or reload animations play out without the weapon snapping back to the current aim target.

Typical usage: drive **Aim Lock Weight** with an animation curve that stays at 1.0 during a reload or recoil animation, then blends back to 0.0 when the weapon should resume tracking the target.

[Aim Down Sights](#aim-down-sights), [Body Depenetration](#body-depenetration), [Kick](#kick), [Weapon Bob](#weapon-bob), [Idle Sway](#idle-sway), and [Landing Dip](#landing-dip) keep working on the locked muzzle. By default, ADS blends out while Aim Lock is on (see [Blend Out During Aim Lock](#blend-out-during-aim-lock)).

| Property | Type | Description |
|----------|------|-------------|
| Aim Lock Weight | float | 0.0 = weapon tracks the target normally. 1.0 = weapon keeps the same procedural aim adjustment it had when the weight first became nonzero. Intermediate values blend between the two. |

![Aim lock comparison](_media/aim-lock-comparison.mp4 ':type=video autoplay loop muted playsinline')

#### Aim Lock Motion Reference

Controls the element relative to which Aim Lock preserves authored muzzle motion. This is useful for first-person setups where the POV bone is free to move around during a reload or recoil animation and the weapon should be kept in frame.

| Property | Type | Description |
|----------|------|-------------|
| Aim Lock Motion Reference | Rig Element Key | The element relative to which authored muzzle motion is preserved |

In a first-person setup, the POV and weapon are usually on different branches of the skeleton. Set **Aim Lock Motion Reference** to their closest shared ancestor, typically an upper spine bone. Reload or recoil motion on the arm below that ancestor remains visible, while the result is placed relative to the current POV. This lets the player rotate the camera freely during the animation without making the weapon lag behind or move toward and away from the camera.

[Quick Setup](#quick-setup) fills this automatically for first-person presets and leaves it unset for third-person presets. If you configure it manually, choose a reference bone higher in the hierarchy than the arm animation you want to preserve.

![Aim Lock motion reference comparison](_media/aim-lock-motion-reference-comparison.mp4 ':type=video autoplay loop muted playsinline')

### Arm Adjustment

After the muzzle transform is decided the arms holding the weapon are minimally adjusted (via [Adjust Three Bone Chain](adjust-three-bone-chain.md)) to keep the hands fixed relative to the muzzle. This is what creates the actual motion of the weapon, which is assumed to be parented to one of the arms. Each arm's [Clavicle](#clavicle) can also move the shoulder.

> This does not mean that the hands are always snapped to the gun. If in the input pose / animation the hands are on the gun, they will stay on the gun. If a hand is not on the gun (e.g., because it's reaching to reload a magazine), that motion is preserved no matter where the gun is pointing. This makes it safe to do aiming on top of custom animations.

| Property | Type | Description |
|----------|------|-------------|
| Copy Hand To Weapon IK Bone | [Copy Hand To Weapon IK Bone Settings](#copy-hand-to-weapon-ik-bone) | Keeps the IK hand bones, such as `ik_hand_l`, where the animation put them relative to the hand holding the weapon |
| Arms | list of [Arm Settings](#arm-settings) | The arms holding the weapon |

#### Copy Hand To Weapon IK Bone

Skeletons like the Unreal Engine mannequins have IK hand bones: `ik_hand_l` and `ik_hand_r` under `ik_hand_gun`. The animation keeps them where the hands hold the weapon. But other logic, such as layered blends and turn-in-place, can move the hands without moving the IK bones. Then they no longer match.

This setting moves the weapon IK bone to the hand that holds the weapon, after that hand is aimed. The IK hand bones under it then keep their place relative to that hand. The arms can follow them with [Reference Element](#arm-settings), or you can use them for hand IK later in the Animation Blueprint. This replaces a **Copy Bone** node from `hand_r` to `ik_hand_gun` after the Control Rig.

| Property | Type | Description |
|----------|------|-------------|
| Hand | Rig Element Key | The hand holding the weapon, typically `hand_r`. Use the hand bone itself, not a socket such as `HandGrip_R` |
| Weapon IK Bone | Rig Element Key | The bone the IK hand bones are parented to, typically `ik_hand_gun`. It must not be under a hand or above the arms |
| Weight | float | 0 leaves the Weapon IK Bone where the input pose put it. 1 puts it on the Hand, moved with the weapon. Lower it while the weapon changes hands |

If the weapon is attached to the weapon IK bone instead of a hand, set **Hand** to the **Weapon IK Bone** too. Then the weapon IK bone moves with the aimed weapon like the hands do, but is not moved onto either hand. So either hand can let go of the weapon.

#### Arm Settings

Each arm entry uses the following struct:

| Property | Type | Description |
|----------|------|-------------|
| Chain | [Three Bone Chain](three-bone-chain.md?id=three-bone-chain) | The arm chain to adjust |
| Stretch | [Stretch Settings](three-bone-chain.md?id=stretch-settings) | Settings for how the arm handles targets at or beyond reach |
| Twist | [Twist Settings](three-bone-chain.md?id=twist-settings) | Settings for twisting the arm around the root-to-end axis |
| Clavicle | [Clavicle Settings](#clavicle) | Settings for rotating the clavicle to keep the stock planted on the shoulder and to reach toward the hand instead of stretching the arm |
| Reference Element | Rig Element Key | An element the hand can follow, such as the IK hand bone `ik_hand_l`. It only follows the aimed weapon if it is under the [Weapon IK Bone](#copy-hand-to-weapon-ik-bone) and **Copy Hand To Weapon IK Bone > Weight** is above 0 |
| Reference Weight | float | 0 keeps the hand where the input pose put it relative to the weapon. 1 puts the hand on the **Reference Element**. Defaults to 0 |

Quick Setup fills in **Reference Element** but leaves **Reference Weight** at 0. To IK the left hand onto the weapon, simply set **Reference Weight** to 1 in the left arm's entry under **Arms**. This works well if your animations keep `ik_hand_l` where the left hand should be. Retargeted animations often don't.

##### Clavicle

Each arm can move its shoulder by rotating its clavicle for two reasons:

- To keep the stock planted on the shoulder if it was resting on it in the input pose (e.g., moving back with the [kick](#kick), or along with the stock as the weapon aims up or down).

![Firing with clavicles off and on](_media/aim-weapon-clavicle-kick-comparison.mp4 ':type=video autoplay loop muted playsinline')

- To prevent the arm from stretching (e.g., when aiming far up or down). This only starts when the arm is almost straight. Until then, the clavicle stays put and the elbow bends or straightens instead.

![Aiming far up in first person with clavicles off and on](_media/aim-weapon-shoulder-reach-comparison.png)

[Quick Setup](#quick-setup) fills in the clavicles and sizes **Shoulder Contact Radius** and **Reach Start Distance** for your character.

| Property | Type | Description |
|----------|------|-------------|
| Bone | Rig Element Key | The clavicle bone, typically the parent of the arm's Root Bone, such as `clavicle_r` above `upperarm_r`. If unset, the shoulder doesn't move |
| Shoulder Contact Radius | float (cm) | How close the stock has to be to the shoulder in the input pose for the shoulder to move with it. The stock is [Body Depenetration](#body-depenetration)'s **Contact Points** (which can be set automatically by [Weapon Analysis](#weapon-analysis)). Within this distance of the shoulder joint, the shoulder moves fully with the stock. This fades out as the distance grows to twice that, so raising a rifle to the shoulder blends in smoothly. If several points are close, the shoulder follows a blend of them, weighted by how fully each one rests on it. 0 turns this off |
| Follow Stock Clamp | [Follow Stock Clamp](#follow-stock-clamp) | How much the shoulder can move in response to the stock's motion. Limit this to (e.g.,) prevent excessive kick or the shoulders scrunching up under the chin |
| Reach Start Distance | float (cm) | How far the hand has to be from the shoulder for the shoulder to start reaching toward it. This way the arm (almost) straightens first and the shoulder only starts moving to prevent overextension. If the hand is already farther than this in the input pose (e.g., the arm is already nearly straight), that distance is used instead |
| Weight | float | Blend weight of the whole "move the shoulder by rotating the clavicle" effect |

##### Follow Stock Clamp

How far the shoulder can move in response to the stock moving, to keep the stock planted on the shoulder. This is specified along each of the muzzle's axes in the input pose.

| Property | Type | Description |
|----------|------|-------------|
| Forward | Range (cm) | Along the barrel. Negative is backward, positive is forward. Defaults to -10 to 4 |
| Right | Range (cm) | Right from the muzzle's perspective. Negative is left, positive is right. Defaults to -2 to 2 |
| Up | Range (cm) | Up from the muzzle's perspective. Negative is down, positive is up. Defaults to -2 to 3 |

### Smoothing In Aim Weapon

Aim Weapon uses [Smoothing Settings](smoothing.md) in several places: muzzle distance, pivot rotation, ADS rotation around sights, weapon bob intensity, and idle sway intensity. In every case, disabling smoothing makes that part of the weapon response follow its current target immediately with no spring lag.

## Debug Draw

| Property | Type | Description |
|----------|------|-------------|
| Enabled | bool | Whether to draw debug visualization |
| Scale | float | Scale factor for debug visualization sizes |

Use this debug view in this order:

1. Check the blue point and green line to confirm the ADS line of sight.
2. Check the sight and muzzle axes to verify the final orientation.
3. Check the yellow arc and clamp overlay if the weapon is not reaching the target.
4. Check the orange lines if the shoulders move unexpectedly.

| Debug item | Meaning |
|------------|---------|
| Yellow/red/green clamp overlay | Pivot rotation limits. See [Rotation Clamping debug draw](rotation-clamping.md?id=debug-draw) |
| Blue point | Safe ADS target position after minimum-distance pushing |
| Green line from eye to target | ADS eye-to-target line of sight |
| Red/green/blue axes at front sights | Final front sights transform axes |
| Blue line from front to rear sights | Sight alignment line |
| Blue point at rear sights | Rear sights position |
| Red/green/blue axis lines from muzzle | Final muzzle forward and side axes |
| Yellow arc | Angle from the final muzzle direction to the target direction |
| Orange line and point from each clavicle | Target shoulder location of each [Clavicle](#clavicle) |
