VRTK_InteractHaptics
extends VRTK_InteractableListener
Overview
Provides controller haptics upon interaction with the specified Interactable Object.
Required Components:
- VRTK_InteractableObject- The Interactable Object component to detect interactions on. This must be applied on the same GameObject as this script if one is not provided via the- Object To Affectparameter.
Script Usage:
- Place the VRTK_InteractHapticsscript on either:- The GameObject of the Interactable Object to detect interactions on.
- Any other scene GameObject and provide a valid VRTK_InteractableObjectcomponent to theObject To Affectparameter of this script.
 
Inspector Parameters
- Clip On Near Touch: Denotes the audio clip to use to rumble the controller on near touch.
- Strength On Near Touch: Denotes how strong the rumble in the controller will be on near touch.
- Duration On Near Touch: Denotes how long the rumble in the controller will last on near touch.
- Interval On Near Touch: Denotes interval betweens rumble in the controller on near touch.
- Cancel On Near Untouch: If this is checked then the rumble will be cancelled when the controller is no longer near touching.
- Clip On Touch: Denotes the audio clip to use to rumble the controller on touch.
- Strength On Touch: Denotes how strong the rumble in the controller will be on touch.
- Duration On Touch: Denotes how long the rumble in the controller will last on touch.
- Interval On Touch: Denotes interval betweens rumble in the controller on touch.
- Cancel On Untouch: If this is checked then the rumble will be cancelled when the controller is no longer touching.
- Clip On Grab: Denotes the audio clip to use to rumble the controller on grab.
- Strength On Grab: Denotes how strong the rumble in the controller will be on grab.
- Duration On Grab: Denotes how long the rumble in the controller will last on grab.
- Interval On Grab: Denotes interval betweens rumble in the controller on grab.
- Cancel On Ungrab: If this is checked then the rumble will be cancelled when the controller is no longer grabbing.
- Clip On Use: Denotes the audio clip to use to rumble the controller on use.
- Strength On Use: Denotes how strong the rumble in the controller will be on use.
- Duration On Use: Denotes how long the rumble in the controller will last on use.
- Interval On Use: Denotes interval betweens rumble in the controller on use.
- Cancel On Unuse: If this is checked then the rumble will be cancelled when the controller is no longer using.
- Object To Affect: The Interactable Object to initiate the haptics from. If this is left blank, then the Interactable Object will need to be on the current or a parent GameObject.
Class Events
- InteractHapticsNearTouched- Emitted when the haptics are from a near touch.
- InteractHapticsTouched- Emitted when the haptics are from a touch.
- InteractHapticsGrabbed- Emitted when the haptics are from a grab.
- InteractHapticsUsed- Emitted when the haptics are from a use.
Unity Events
Adding the VRTK_InteractHaptics_UnityEvents component to VRTK_InteractHaptics object allows access to UnityEvents that will react identically to the Class Events.
- All C# delegate events are mapped to a Unity Event with the Onprefix. e.g.MyEvent->OnMyEvent.
Event Payload
- VRTK_ControllerReference controllerReference- The reference to the controller to perform haptics on.
Class Methods
CancelHaptics/1
public virtual void CancelHaptics(VRTK_ControllerReference controllerReference)
- Parameters
- VRTK_ControllerReference controllerReference-
 
- Returns
- none
 
The CancelHaptics method cancels any existing haptic feedback on the given controller.
HapticsOnNearTouch/1
public virtual void HapticsOnNearTouch(VRTK_ControllerReference controllerReference)
- Parameters
- VRTK_ControllerReference controllerReference- The reference to the controller to activate the haptic feedback on.
 
- Returns
- none
 
The HapticsOnNearTouch method triggers the haptic feedback on the given controller for the settings associated with near touch.
HapticsOnTouch/1
public virtual void HapticsOnTouch(VRTK_ControllerReference controllerReference)
- Parameters
- VRTK_ControllerReference controllerReference- The reference to the controller to activate the haptic feedback on.
 
- Returns
- none
 
The HapticsOnTouch method triggers the haptic feedback on the given controller for the settings associated with touch.
HapticsOnGrab/1
public virtual void HapticsOnGrab(VRTK_ControllerReference controllerReference)
- Parameters
- VRTK_ControllerReference controllerReference- The reference to the controller to activate the haptic feedback on.
 
- Returns
- none
 
The HapticsOnGrab method triggers the haptic feedback on the given controller for the settings associated with grab.
HapticsOnUse/1
public virtual void HapticsOnUse(VRTK_ControllerReference controllerReference)
- Parameters
- VRTK_ControllerReference controllerReference- The reference to the controller to activate the haptic feedback on.
 
- Returns
- none
 
The HapticsOnUse method triggers the haptic feedback on the given controller for the settings associated with use.
Updated less than a minute ago
