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.
- Listed in Global namespace: E to H
- Inherits or implements
MonoBehaviour
Constructors
| Member | What it is |
|---|---|
HandGestureTrigger() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private Transform cachedTransform | This object's transform, used to convert positions into local space. |
private HandGestureDefinition definition | The gesture to force on the hand. |
private float distanceToTrackPlayerSquared | Squared horizontal distance from the feet within which hands are tracked. |
private float largeDistanceCheckDelay | Seconds to wait before checking again when the player is far away. |
private Bounds localBounds | Box in local space that the hand must be inside. |
private float nextCheck | Real time of the next distance check. |
private IUnityUpdateMethod updatePlayerTracking | Handle for the registered late update method. |
Methods
8 private and internal methods
| Member | What 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. |