Skip to content
EN

Trigger Components

The Hapbeat SDK provides a variety of Trigger components that let you add haptics without writing code.

ComponentWhen it firesPrimary use caseShowcase Zone
HapbeatUnityEventTriggerFire() called from a UnityEventUI Button / XR Interactable / Animation Event, etc.Z5 Charge
HapbeatStateBehaviourAnimator state Enter / ExitCharacter actions, UI animations, door opening/closing, etc.Z2 Door
HapbeatCollisionTriggerOnCollision / OnTriggerCollisions, hit detection, projectile impactsZ1 Bowling
HapbeatSequenceTriggerThree phases: grab / hold / releaseXR Interaction (grab, hold, release)Z3 Fishing
HapbeatTickEmitterSnap-fires based on rate of change in a continuous valueScroll haptics for Slider / ScrollRect, etc.Z4 Stream Console

Fires by wiring the Fire() method to a UnityEvent (Button.OnClick / XRI Activate / Animation Event, etc.). Lets you trigger haptics from any UnityEvent without writing code.

Setup:

  • Event Map: Reference to an EventMap.asset
  • Event: Select an entry from the EventMap via dropdown
On Activated:
[Hapbeat Event Router] → HapbeatUnityEventTrigger.Fire()

A StateMachineBehaviour derivative that attaches directly to states in an AnimatorController. It is called directly by the Animator runtime at state Enter / Exit, making fire timing and conditions clearer than polling Animator parameters from a scene MonoBehaviour.

Unlike regular Triggers, this does not appear in the Add Component menu. Add it via: Animator window → select the target state → Inspector → Add Behaviour → Hapbeat State Behaviour.

Setup:

  • Event Map: EventMap.asset
  • Entry On Enter / Entry On Exit: Fire a different entry for each state transition (one side alone is fine)
  • Required Previous State: If non-empty, Enter fires only when transitioning from the specified state (e.g. only play a rattle sound on Closed → LockedRattle)
  • Gain Multiplier: Additional multiplier on top of entry gain × manifest intensity

Implementation notes:

  • If a looping StreamClip is fired on Enter, it is automatically stopped on Exit — looped sounds tied to a state end cleanly
  • Reference fields (EventMap, etc.) are saved on the AnimatorController asset (ScriptableObject-to-ScriptableObject reference — no scene dependency)
  • Showcase Z2 Door: One instance attached to each of the Open and Closed states, firing door_open / door_close

Fires on Collision / Trigger events. Supports velocity-scaled gain (Gain Mode: VelocityScaled).

Setup:

  • Tag Filter: Tag of objects to respond to (empty = all)
  • Layer Mask: Layer filter
  • Gain Mode: Fixed / VelocityScaled
  • Min Velocity: Does not fire below this speed
  • Cooldown: Prevents repeated firing (seconds)

Enables mappings like “harder impact → stronger haptic feedback.”

Designed for use with XR Interaction Toolkit or custom grab systems. Manages 3 phases of events in a single component.

Setup:

  • On Grab: Event for the moment of grabbing (e.g. bowling.grab)
  • On Hold: Continuous event while held (CLIP recommended, e.g. bowling.hold)
  • On Release: Event for the moment of release (e.g. bowling.release)

Import the XR Helpers sample (Samples~/XriHelpers/) to automatically set up integration with XRGrabInteractable / XRSocketInteractor (the scaffold itself does not break even if XRI is not installed in the project).

Fires using a snap algorithm based on the rate of change in a continuous value such as a Slider or ScrollRect.

  • No cooldown needed (the algorithm self-limits rapid firing)
  • Adjust sensitivity via snap interval

Pair with HapbeatParameterBinding to map Transform / Rigidbody values to StreamClip gain / pan every frame.

Examples: stronger haptic feedback as an object gets closer; vibration that intensifies with movement speed.

Details: Parameter Binding

Menu bar → HapbeatDebugAttach Event Logger to Selected logs UnityEvent invocations on the selected GameObject to the Console. Useful for visualizing XRI event firing order.

To record detailed logs: Hapbeat → Debug → Logs → Start Recording