Skip to content

Touching Interactable Objects

StoneFox edited this page Jun 6, 2016 · 1 revision

[VRTK_InteractTouch]

The Interact Touch script is attached to a Controller object within the [CameraRig] prefab.

The following script parameters are available:

  • Hide Controller On Touch: Hides the controller model when a valid touch occurs
  • Hide Controller Delay: The amount of seconds to wait before hiding the controller on touch.
  • Global Touch Highlight Color: If the interactable object can be highlighted when it's touched but no local colour is set then this global colour is used.

The following events are emitted:

  • ControllerTouchInteractableObject: Emitted when a valid object is touched
  • ControllerUntouchInteractableObject: Emitted when a valid object is no longer being touched

The event payload that is emitted contains:

  • controllerIndex: The index of the controller doing the interaction
  • target: The GameObject of the interactable object that is being interacted with by the controller

An example of the VRTK_InteractTouch can be viewed in the scene SteamVR_Unity_Toolkit/Examples/005_Controller/BasicObjectGrabbing. The scene demonstrates the highlighting of objects that have the VRTK_InteractableObject script added to them to show the ability to highlight interactable objects when they are touched by the controllers.