Skip to main content

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​

MemberWhat 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
MemberWhat it is
private Interactor interactorThe hand's interactor, watched for interactions starting.
private bool needToReenterAfterInteractIf true, interacting also removes the tracker, so the hand must leave and re-enter to swipe again.
private Action<Rigidbody> removeRigidbodyCallback that removes this tracker from the controller's dictionary.
private IUnityUpdateMethod updateHandle for the registered CalculateSwipe update.
private static UpdateModule updateModuleShared late-update module for all swipe trackers.

Properties​

MemberWhat 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
MemberWhat 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​

MemberWhat it is
void Finish()Stops the update and unhooks from the interactor.
3 private and internal methods
MemberWhat 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: