A class in Root.Township, Alta.Character.
Places and turns a body renderer under the head so it follows where the player is looking, and on first use splits the body into a shadow-only original and a visible copy hidden from the player's own headset view. Runs in edit mode too.
Constructors
| Member | What it is |
|---|
BodyProjection() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
| Member | What it is |
|---|
private AnimationCurve angleInterpolation | Curve from angle difference (0 to 180 degrees) to how fast the body turns to catch up with the head. |
private Renderer body | The body renderer. Cleared to null once the hidden copy has been made. |
private Transform head | The head transform the body follows. |
private Transform leftHand | Left hand transform. Not used by this code. |
private float lerpTime | Running turn speed, built up from angleInterpolation and slowly decayed each frame. |
private Transform rightHand | Right hand transform. Not used by this code. |
Methods
2 private and internal methods
| Member | What it is |
|---|
private void LateUpdate() | Each frame while the head is active, moves the body to sit below the head and eases its rotation toward the head's heading, tilting it as the head lowers. The first time, it also makes the copy of the body. |
private void Start() | Turns shadow casting and receiving on for the body renderer. |