Skip to main content

HandGestureTrigger

A class in Root.Township, the global namespace.

Client: forces a hand gesture (such as a pose) on the local player's free hand while it is inside a box near this object. Destroys itself on a headless server.

Constructors​

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

Fields​

7 private and internal fields
MemberWhat it is
private Transform cachedTransformThis object's transform, used to convert positions into local space.
private HandGestureDefinition definitionThe gesture to force on the hand.
private float distanceToTrackPlayerSquaredSquared horizontal distance from the feet within which hands are tracked.
private float largeDistanceCheckDelaySeconds to wait before checking again when the player is far away.
private Bounds localBoundsBox in local space that the hand must be inside.
private float nextCheckReal time of the next distance check.
private IUnityUpdateMethod updatePlayerTrackingHandle for the registered late update method.

Methods​

8 private and internal methods
MemberWhat it is
private void CleanController(Controller controller)Clears this trigger's gesture override from the controller's hand, if it set it, and resets the grip animation.
private void OnDisable()Stops tracking and clears the override from both hands.
private void OnDrawGizmosSelected()Draws the trigger box in the editor.
private void OnEnable()Starts tracking the local player now, or once PlayerController.LocalPlayerSet fires.
private void SetLocalPlayer(PlayerController player)Registers UpdatePlayerTracking on the late update loop for the given local player.
private void Start()Destroys the component on a headless server.
private void TrackController(Controller controller, Matrix4x4 worldToLocal)Sets the gesture override while the hand's grip point is inside localBounds and the hand holds nothing, else clears it.
private void UpdatePlayerTracking()Late update: tracks both hands when the player's feet are close, otherwise clears them and waits largeDistanceCheckDelay before checking again.