BillboardToPlayer
A class in Root.Township, the global namespace.
Client component that turns an object to face the local player's head every late update, optionally smoothed. Removes itself on a headless server and pauses while the player is dead.
- Listed in Global namespace: A to B
- Inherits or implements
MonoBehaviour - Attributes
ExecuteInEditMode
Constructors
| Member | What it is |
|---|---|
BillboardToPlayer() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
Methods
| Member | What it is |
|---|---|
void SetRotationOffset(Quaternion offset) | Sets the extra rotation applied after facing the player. |
7 private and internal methods
| Member | What it is |
|---|---|
private void Awake() | Destroys itself if headless; otherwise listens for the local player being set and starts tracking. |
private float DeltaTime() | Returns Time.deltaTime. |
private Quaternion GetRotation(Transform cameraTransform) | Rotation looking at the given transform with rotationOffset, lerped by lerpSpeed unless that's 0 or less. |
private void LateUpdate() | Faces the current player's Head. |
private void OnDestroy() | Unsubscribes from the player and death events. |
private void PlayerKilled(DamageData damageData) | Turns the billboard off when the local player dies. |
private void UpdatePlayer(PlayerController player) | Enables the component and subscribes to the player's death when there is one, or disables it when null. |