Guides

VRTK_ObjectTouchAutoInteract

extends VRTK_InteractableListener

Overview

Allows for Interact Grab or Interact Use interactions to automatically happen upon touching an 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 Interactable Object parameter.

Script Usage:

  • Place the VRTK_ObjectTouchAutoInteract script on either:
    • The GameObject of the Interactable Object to detect interactions on.
    • Any other scene GameObject and provide a valid VRTK_InteractableObject component to the Interactable Object parameter of this script.

Inspector Parameters

  • Grab On Touch When: Determines when a grab on touch should occur.
  • Regrab Delay: After being ungrabbed, another auto grab on touch can only occur after this time.
  • Continuous Grab Check: If this is checked then the grab on touch check will happen every frame and not only on the first touch of the Interactable Object.
  • Use On Touch When: Determines when a use on touch should occur.
  • Reuse Delay: After being unused, another auto use on touch can only occur after this time.
  • Continuous Use Check: If this is checked then the use on touch check will happen every frame and not only on the first touch of the Interactable Object.
  • Interactable Object: The Interactable Object that the auto interaction will occur on. If this is blank then the script must be on the same GameObject as the Interactable Object script.

Class Variables

  • public enum AutoInteractions - Situation when auto interaction can occur.
    • Never - Auto interaction can never occur on touch.
    • NoButtonHeld - Auto interaction will occur on touch even if the specified interaction button is not held down.
    • ButtonHeld - Auto interaction will only occur on touch if the specified interaction button is held down.