MovementBendController
A class in Root.Township, the global namespace.
Client-side visual: tilts a player's skirt bone as their head moves, so the body leans with movement. Removed on headless servers; for the local player it follows the body bending setting.
- Listed in Global namespace: M to O
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
MovementBendController() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
11 private and internal fields
| Member | What it is |
|---|---|
private Quaternion baseSkirtRotation | Local rotation of the bone with no bend. |
private BodyController bodyController | Body controller giving the head position and settings. |
private bool btnRead | Inspector button flag labelled Read Rotation. |
private CharacterDummyPointer dummy | Character dummy that owns the bone. |
private Vector3 lastPosition | Lagging head position on the ground plane. |
private static Logger logger | Class logger; unused in this build. |
private float maxDistanceSquared | If the head jumps further than this (squared), the bend resets, as after a teleport. |
private Quaternion movementBend | Current bend rotation. |
private Vector3 originalUp | Reference direction used to orient the bend axis. |
private Transform skirtMovementTarget | Bone transform being rotated. |
private BoneIdentifier skirtMovementTargetBone | Which bone to rotate. |
Methods
7 private and internal methods
| Member | What it is |
|---|---|
private void CalculateMovementBend(Vector3 headPosition, BodyControllerSettings settings) | Works out a bend from how far the head has moved from a lagging point and blends the bone rotation toward it. |
private void CheckForEnabledInSettings(Settings settings) | Enables the component based on the local player's body bending setting. |
private void OnDestroy() | Unhooks the settings event. |
private void OnDisable() | Resets the bend and the lagging position. |
private void OnDrawGizmosSelected() | Draws the lagging point and a line to the head. |
private void Start() | Finds the target bone; destroys itself on headless servers. |
private void Update() | Updates the bend each frame, or disables itself if the player is being destroyed. |