# Aim Chain

The **Aim Chain** node rotates a chain of elements (typically pelvis → spine → neck → head) so a child element aims at a target location. In third-person rigs it usually sits immediately after [Clamp Aim Target](clamp-aim-target.md), which keeps the incoming target inside a range the chain can actually reach.

![Aim Chain fed by Clamp Aim Target](_media/aim-chain-node.png ':size=1200')

## Usage

1. Add the **Aim Chain** node after [Clamp Aim Target](clamp-aim-target.md), or connect a target directly in <span class="fr-term" tabindex="0" data-tooltip-key="global-space">global space</span> if you do not need clamping
2. Preview the result
3. If the detected setup is not quite right, right-click the node and pick a different Quick Setup from the dropdown, or edit **Child**, **Chain Segments**, and **Limb Adjustment** manually
4. Tune limits, smoothing, or limb adjustment only if your rig needs it

## 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.

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

Aim Chain can generate two kinds of presets:

- **Head/body presets**: it looks for a bone chain from a `pelvis` or `hips` ancestor up to a `head` bone. If it finds a POV-style child bone under the head (`pov`, `camera`, `view`, or `eyes`), it aims that child; otherwise it aims the head itself. It then chooses the child's local forward axis by snapping to the local ±X/±Y/±Z axis closest to the <span class="fr-term" tabindex="0" data-tooltip-key="project-global-forward-axis">project global forward direction</span> in the preview pose. After that it splits the detected chain into a pelvis/spine segment and a neck/head segment based on names like `pelvis`, `hips`, and `spine`, and it auto-populates limb adjustment for limbs connected to that chain.
- **Tail presets**: it looks for the longest chain whose names contain `tail`, then aims the tip away from the target.

</details>

If your skeleton does not have a recognizable `pelvis`/`hips` to `head` chain, or it uses very different naming, Quick Setup will not offer a head/body preset. In that case, set **Child** to the head or POV element, then build the spine and neck segments manually.

## Input Pins

| Pin | Type | Description |
|-----|------|-------------|
| Target | Vector | The location to aim at in <span class="fr-term" tabindex="0" data-tooltip-key="global-space">global space</span> |
| Child | [Aim Element](aim-element.md) | The child element and axis to aim at the target |
| Chain Segments | list of [Chain Segment](#chain-segments) | The chain segments to rotate, processed in order |
| Apply Full Rotation To Final Bone | bool | When true, the last element in the last segment applies the full remaining rotation to reach the target |
| Limb Adjustment | [Limb Adjustment](limb-adjustment.md) | How to restore connected limbs after the chain rotates |
| Debug | [Debug Settings](#debug-draw) | Debug draw settings |
| Aim Lock Weight | float | Freezes the chain's current procedural aim adjustment when the weight becomes nonzero. This is useful during recoil or reload animations: use a curve that spikes to 1.0 on fire, then decays back to 0.0 as the recoil settles. |
| Weight | float | The blend weight of this operation (0.0 = no effect, 1.0 = full effect) |

### Child

Use **Child** to choose which element at the end of the chain should actually point at the target. In most body-look setups this is the head or a POV child under the head, and in tail setups it is the tail tip.

See [Aim Element](aim-element.md) for the full property breakdown, including **Aim Mode**, **Local Axis**, and **Reference Target**.

### Chain Segments

Each chain segment specifies a group of elements to rotate and how much of the total rotation each element should contribute. Multiple segments can be combined to create setups like spine → neck → head. The segments are processed in order, and each element rotates by a fraction of the remaining rotation needed to reach the target.


| Property | Type | Description |
|----------|------|-------------|
| Bones | list of Rig Element Keys | The elements in this segment, processed in order. Each element contributes rotation toward aiming at the target |
| Preserve Upright | [Preserve Upright Settings](#preserve-upright) | Controls how strongly each bone resists the roll that aiming sideways would otherwise introduce. See [Preserve Upright](#preserve-upright) |
| Rotation Clamp | [Rotation Clamp Settings](rotation-clamping.md) | Per-element rotation clamp applied to each element in this segment. For example, to allow 3 spine elements to collectively aim 90° total, set 30° per element here. Quick setups pre-divide for you |
| Rotation Fraction Per Bone | float | The fraction of the total rotation that each element in this segment contributes. 0.5 means each element does 50% of the remaining rotation needed. 1.0 means each element tries to fully aim at the target, letting later elements correct what is left |
| Smoothing | [Smoothing Settings](smoothing.md) | Spring smoothing stored on the segment and applied to each element in it |

#### Preserve Upright

When a bone aims at a target off to one side, the shortest-arc aim offset rotation also rolls the bone from the camera's point of view, adding unnecessary tilt. Preserve Upright corrects this by adding a twist around the aim axis so that the aim element (e.g. the `pov` bone) stays as upright in the adjusted pose as it was in the input pose. It does not force a specific axis to stay upright but preserves the style of the underlying animation.

![Preserve Upright comparison](_media/preserve-upright-comparison.mp4 ':include :type=video autoplay loop muted playsinline')

| Property | Type | Description |
|----------|------|-------------|
| Weight | float (0–1) | How strongly to preserve uprightness. 0 lets the bone roll freely with the aim; 1 (the default) keeps the axis of the aim element that was pointing up in the input pose pointing up in the adjusted pose. "Up" is defined in <span class="fr-term" tabindex="0" data-tooltip-key="global-space">global space</span> here. |
| Fade Start Angle | float (0–90°, default 20°) | Within this angle of aiming straight up or straight down, the correction fades out to zero. Uprightness is undefined when aiming straight up or down, and forcing the correction there causes the bone to spin. Larger values give a smoother fade but prevent full correction closer to vertical; smaller values keep full correction closer to the poles but allow faster spinning near them |

#### Rotation Clamp

Each segment stores one rotation clamp, and Aim Chain applies that clamp to every element in the segment as it solves down the chain. Think of the values here as per-element limits, not as a total budget for the whole segment.

See [Rotation Clamping](rotation-clamping.md).

#### Smoothing

Each segment also stores one smoothing setup, and every element in that segment uses it when its solved rotation is written back. Use more smoothing on broader body segments for softer follow-through, and less smoothing on final segments when you want snappier tracking.

See [Smoothing](smoothing.md).

### Limb Adjustment

When pelvis rotates, legs can drift away from the pose you started with. Limb Adjustment captures those limb effectors before the aim solve and restores them afterward.

![Limb adjustment comparison](_media/aim-chain-limb-adjustment-comparison.mp4 ':include :type=video autoplay loop muted playsinline')

See [Limb Adjustment](limb-adjustment.md) for the full settings.

## 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 red line to see where the chain is currently aiming.
2. Check the yellow arc to see how far it still needs to turn.
3. Check the clamp overlay to see whether rotation limits are blocking the solve.

| Debug item | Meaning |
|------------|---------|
| Red line from the aim origin | Current aim direction |
| Green and blue side lines from the aim origin | The child element's local Y and Z axes |
| Yellow arc | Angle from the current aim direction to the target direction |
| Yellow/red/green clamp overlay | Rotation limits for the solved segments. See [Rotation Clamping debug draw](rotation-clamping.md?id=debug-draw) |
