Skip to main content

HapticWhileHeld

A class in Root.Township, Alta.Pages.

Component that buzzes the holding hand's controller every frame while its Pickup is held. Client side.

Constructors​

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

Fields​

3 private and internal fields
MemberWhat it is
private AltaCoroutine hapticThe running haptic coroutine, if any.
private Pickup pickupBacking field for Pickup.
private float strengthBacking field for Strength.

Properties​

MemberWhat it is
Pickup Pickup { get; set; }The pickup to watch. Found on the same object by default.
float Strength { get; set; }Haptic strength sent to the controller.

Methods​

5 private and internal methods
MemberWhat it is
private IEnumerator Haptic() (iterator)Coroutine that triggers a haptic pulse of strength on every interactor's controller each frame.
private void InteractionEnded(Interactable arg1, Interactor arg2)Stops the haptic coroutine when the pickup is let go.
private void InteractionStarted(Interactable arg1, Interactor arg2)Restarts the haptic coroutine when the pickup is grabbed.
private void OnDisable()Unhooks from the pickup's interaction events.
private void OnEnable()Hooks the pickup's interaction events, starting the buzz at once if it is already held.