Recipes & Workflows
Recipes & Workflows
Practical, copy‑paste guides for the most common scenarios. Pick the one that matches your use‑case and you’ll be reacting in minutes.
Procedural Hit Reactions 1.1 – Important Changes
In version 1.1, the values previously found within the BodyPartReactor have been moved to the new Reaction Profiles system. The BodyPartReactor now only contains:
Bone Reference
Reaction Profile
Follow Objects
Per-Bone Multiplier (new), which allows you to adjust the intensity and duration of the reaction per bone.
These changes are part of the updated and more flexible profiles/body part reactor system, designed to give you greater control and customization.

5.1 Animating a Humanoid Character
Goal: Add subtle chest‑and‑head flinch to a third‑person hero.
Add Components
HitReactionController
on the root.BodyPartReactor
on Chest and Head bones.
Assign Profiles
Chest → Light Hit (rotation only).
Head → Light Hit (rotation + small translation).
Animator Layer
Create Layer 1 – Reactions (Override, Weight 1). No clips needed.
Test
Drag the FPS Gun prefab into the scene and shoot at the hero.
Adjust Rotation Strength Z on the Head profile to ≈2° to avoid dizzy spins.
Pro Tip: If your rig already leans forward while running, enable Offsets From Current Pose in the profile to prevent double‑bending.
5.2 Adding Reactions to Props / Creatures
Options like Additive and OverrideOnHit has been moved to the ReactionProfile since 1.1
Example: A hanging lantern that swings when hit.
Place
BodyPartReactor
on the lantern mesh (no Animator required).Uncheck Additive so the offset fully replaces the static pose.
Create a Lantern Swing profile:
Reaction Duration = 1 s, Blend‑In = 2, Blend‑Out = 1.
Rotation Strength = (0,20,0) — allow only yaw.
Rotation Axis Mask = (0,1,0).
Fire a projectile at the lantern → it now swings procedurally.
No collider? Add a small sphere collider so
HitReactionTrigger
can register impacts.
5.3 Custom Projectiles & Melee Weapons
Projectile (arrow)
// When spawning your arrow prefab …
var arrow = Instantiate(arrowPrefab, originPos, originRot);
arrow.GetComponent<HitReactionTrigger>().reactLayers = LayerMask.GetMask("Characters");
arrow.GetComponent<Rigidbody>().velocity = originForward * 60f;
Set Destroy On Hit to ✔️ so the arrow sticks once.
Melee Blade
Add a thin Trigger Collider along the sword edge.
Swap
OnCollisionEnter
→OnTriggerEnter
inside a copy ofHitReactionTrigger
(or convert collider to non‑trigger).Swing the sword: every overlap with a body‑part collider triggers
React()
.
5.4 Manual Calls to React()
Need full control (e.g., network sync, animation event)? Call the API directly.
1. Via Animation Event
In your attack animation, add an event at the exact frame of impact.
Event function:
public void PunchEvent() {
Vector3 dir = -transform.right; // fist travels left→right
Vector3 point = fistTip.position;
controller.React("Head", dir, point);
}
2. Networked Hit
Sync the same parameters to all clients and call React()
locally—deterministic since math is purely transform‑based.
// On server
RpcReact(targetId, partName, dir, point);
// On each client
void RpcReact(int id, string part, Vector3 dir, Vector3 pt) {
players[id].controller.React(part, dir, pt);
}
Next Up
Ready to dive deeper? Check out Advanced topics for axis locks, follow‑through chains, and performance tricks.
Last updated