SwipeInteractionController.SwipeTracker
A private class in Root.Township, the global namespace. Reach it through att-stubs' publicized assemblies or Harmony's AccessTools.
Tracks one hand's rigidbody inside a SwipeInteractionController trigger and works out which way it swiped. Client side.
Constructors
| Member | What it is |
|---|
SwipeTracker(Rigidbody rigidbody, Controller controller, Vector3 swipeDirection, float swipeMinDistance, bool needToReenterAfterInteract, Action<Rigidbody> removeRigidbody) | Creates a SwipeInteractionController.SwipeTracker from rigidbody, controller, swipeDirection, swipeMinDistance, needToReenterAfterInteract and removeRigidbody. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private Interactor interactor | The hand's interactor, watched for interactions starting. |
private bool needToReenterAfterInteract | If true, interacting also removes the tracker, so the hand must leave and re-enter to swipe again. |
private Action<Rigidbody> removeRigidbody | Callback that removes this tracker from the controller's dictionary. |
private IUnityUpdateMethod update | Handle for the registered CalculateSwipe update. |
private static UpdateModule updateModule | Shared late-update module for all swipe trackers. |
Properties
| Member | What it is |
|---|
HashSet<Collider> CurrentColliders { get; } | The hand's colliders currently inside the trigger. |
int CurrentSwipeDirection { get; private set; } | 1 or -1 once the hand has moved past the minimum distance along the axis, otherwise 0. |
4 private and internal properties
| Member | What it is |
|---|
private Rigidbody Rigidbody { get; } | The tracked hand rigidbody. |
private Vector3 SwipeDirection { get; } | World-space swipe axis. |
private float SwipeMinDistance { get; } | Distance the hand must move along the axis to count as a swipe. |
private Vector3 SwipeOriginalPosition { get; } | Rigidbody position when it entered the trigger. |
Methods
| Member | What it is |
|---|
void Finish() | Stops the update and unhooks from the interactor. |
3 private and internal methods
| Member | What it is |
|---|
private void CalculateSwipe() | Late update: sets the swipe direction from how far the rigidbody moved along the swipe axis. |
private bool CleanNullColliders() | Drops destroyed or disabled colliders; if none are left, removes the tracker and returns true. |
private void FinishOnInteract(Interactor interactor, Interactable interactable) | When the hand starts an interaction, stops tracking and clears the direction so no swipe fires. |
Used in
Members of other types that take, return or hold a SwipeTracker: