Skip to main content

VisualRotationMimic

A class in Root.Township, the global namespace.

Client: turns this transform to follow how a target transform turns, tracked through one axis and optionally scaled. Off on a headless server.

Constructors​

MemberWhat it is
VisualRotationMimic()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

6 private and internal fields
MemberWhat it is
private Transform cachedTransformThis object's transform.
private IUnityUpdateMethod copyRotationHandle for the registered late-update method.
private Vector3 lastValueThe target's axis direction, in this transform's space, from the last update.
private Vector3 nonRotationAxisAxis on the target whose direction is tracked (default forward).
private float rotationMultiplierScales the copied rotation angle.
private Transform targetTransformTransform whose rotation is followed.

Methods​

4 private and internal methods
MemberWhat it is
private void Awake()Client: stores the starting axis direction and registers CopyRotation in late update.
private void CopyRotation()When the target has moved, applies the change in its nonRotationAxis direction (times rotationMultiplier) to this transform.
private void OnDestroy()Deregisters CopyRotation.
private void OnDrawGizmosSelected()Draws the tracked axis on the target.