Motion Controller
Add head bob, sway, recoil and weapon positioning.
The player hierarchy contains a camera motion object with MotionController. The weapon prefab also uses it to animate the weapon's local transform.
| Behaviour | Purpose |
|---|---|
| Bob motion | Sine-wave motion while walking or running. |
| Sway motion | Motion reacting to look/movement input. |
| Breath sway | Aiming motion, activated through code. |
| Recoil motion | A configurable kick triggered by Recoil(). |
| Positioner | Interpolation between hip, aim and run positions. |
The movement state drives walking/running motion. Enabling a recoil or breath section in the Inspector alone does not trigger it: call the relevant methods. The supplied weapon controller does this as part of firing, aiming and holding breath.
motion.Recoil();
motion.BreathSwayActivation(true);
motion.ToAimPosition();
// Later, when leaving aim:
motion.BreathSwayActivation(false);
motion.ToHipPosition();motion is your assigned MotionController reference. ToRunPosition() selects the configured running pose. ToHipPosition() returns towards the original local position recorded at initialization. Keep the sample hierarchy when starting out so camera look and motion offsets are applied on their intended transforms.
