# BodyPartReactor

## BodyPartReactor Inspector

`BodyPartReactor` is the workhorse that drives offsets on a single bone. You’ll add **one component per bone** that should flinch—typically Chest, Head, UpperArms, maybe Pelvis.

> **Add via:** *Component ▸ Hit Reactions ▸ Body Part Reactor* or drag the prefab helper onto the bone in the Hierarchy.

<figure><img src="https://2750945321-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCksxjdhoQvkDgI7d2ROJ%2Fuploads%2FUgk1Jiy6Pk7k6C2dMTtz%2Fimage.png?alt=media&#x26;token=d4ac0e74-799e-4230-8051-91ce4fb9bf4a" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
In **version 1.1**, the **BodyPartReactor** has been significantly overhauled.\
Most of its previous settings have been moved into the centralized **Reaction Profile** system for cleaner workflows and greater reusability.

The **BodyPartReactor** now serves primarily as a reference and fine-tuning layer, providing per-bone overrides and controls.
{% endhint %}

### Key Changes in 1.1

* **Simplified Structure:**\
  The **BodyPartReactor** now holds only the following:
  * **Bone Reference**
  * **Reaction Profile (new centralized system)**
  * **Follow Objects**
  * **Per-Bone Multiplier (new)** – Adjusts the **intensity** and **duration** of the reaction for this specific bone, offering finer control.

***

### Migrating from 1.0

If you are upgrading from **version 1.0 to 1.1** and find that your presets no longer behave as expected:

* Use the **"Migrate Legacy Settings"** button in the **BodyPartReactor** inspector.
* This will attempt to convert your existing settings into the new system by automatically creating and linking appropriate **Reaction Profiles**, while preserving your per-bone customizations.

***

| Section              | Action                                                                    |
| -------------------- | ------------------------------------------------------------------------- |
| Profile              | Assign or **Create New Profile** button generates a new asset.            |
| Migration            | **Migrate Legacy Settings** button migrates v1.0 fields into the profile. |
| Per-Bone Multipliers | `intensityMultiplier`, `durationMultiplier` scale strength/duration.      |

***

### How It Blends

1. **React()** is called → stores target rotation/position deltas.
2. Each frame in `Update()` it ramps **weight** up (Blend‑In) or down (Blend‑Out) based on profile.
3. In `LateUpdate()` it applies offsets:
   * **Additive Off:** `Lerp/Slerp` bone from bind pose to target.
   * **Additive On:** multiplies current pose by delta. Keeps Animator motion intact.
4. **Animator Layer Weight** is set to match `weight`, ensuring your override layer stays in sync.

***

### Best Practices

* **Chest first:** Start with a single chest reactor; once tuned, copy component to other bones.
* **Carry‑Over for gunfire:** Use *ScaledCarryOver* with a 0.2–0.4 scale to avoid flickering.
* **Inertia chains:** Let shoulders *follow* chest, and head follow shoulders for natural delay.
* **Disable Translation on feet:** Leg rigs often can’t handle additive position offsets—keep them rotation‑only.

***

### Runtime Tweaks via Code

You can toggle or swap profiles at runtime:

```csharp
reactor.profile = heavyHit;
reactor.useLocalHitDirection = false; // e.g., for explosion shockwave
```

Need to disable reactions altogether? Just `enabled = false` on the component.

***

#### Next Up

See the **HitReactionController Inspector** to understand how multiple reactors tie back into one character‑level controller.
