Guides
These docs are for v3.2.0. Click to read the latest docs for v3.3.0.

VRTK_InteractControllerAppearance

Overview

The Interact Controller Appearance script is attached on the same GameObject as an Interactable Object script and is used to determine whether the controller model should be visible or hidden on touch, grab or use.

Inspector Parameters

  • Hide Controller On Touch: Hides the controller model when a valid touch occurs.
  • Hide Delay On Touch: The amount of seconds to wait before hiding the controller on touch.
  • Hide Controller On Grab: Hides the controller model when a valid grab occurs.
  • Hide Delay On Grab: The amount of seconds to wait before hiding the controller on grab.
  • Hide Controller On Use: Hides the controller model when a valid use occurs.
  • Hide Delay On Use: The amount of seconds to wait before hiding the controller on use.

Class Events

  • ControllerHidden - Emitted when the interacting object is hidden.
  • ControllerVisible - Emitted when the interacting object is shown.
  • HiddenOnTouch - Emitted when the interacting object is hidden on touch.
  • VisibleOnTouch - Emitted when the interacting object is shown on untouch.
  • HiddenOnGrab - Emitted when the interacting object is hidden on grab.
  • VisibleOnGrab - Emitted when the interacting object is shown on ungrab.
  • HiddenOnUse - Emitted when the interacting object is hidden on use.
  • VisibleOnUse - Emitted when the interacting object is shown on unuse.

Unity Events

Adding the VRTK_InteractControllerAppearance_UnityEvents component to VRTK_InteractControllerAppearance 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 On prefix. e.g. MyEvent -> OnMyEvent.

Event Payload

  • GameObject interactingObject - The object that is interacting.
  • GameObject ignoredObject - The object that is being ignored.

Class Methods

ToggleControllerOnTouch/3

public virtual void ToggleControllerOnTouch(bool showController, GameObject touchingObject, GameObject ignoredObject)

  • Parameters
  • bool showController - If true then the controller will attempt to be made visible when no longer touching, if false then the controller will be hidden on touch.
  • GameObject touchingObject - The touching object to apply the visibility state to.
  • GameObject ignoredObject - The object that is currently being interacted with by the touching object which is passed through to the visibility to prevent the object from being hidden as well.
  • Returns
  • none

The ToggleControllerOnTouch method determines whether the controller should be shown or hidden when touching an interactable object.

ToggleControllerOnGrab/3

public virtual void ToggleControllerOnGrab(bool showController, GameObject grabbingObject, GameObject ignoredObject)

  • Parameters
  • bool showController - If true then the controller will attempt to be made visible when no longer grabbing, if false then the controller will be hidden on grab.
  • GameObject grabbingObject - The grabbing object to apply the visibility state to.
  • GameObject ignoredObject - The object that is currently being interacted with by the grabbing object which is passed through to the visibility to prevent the object from being hidden as well.
  • Returns
  • none

The ToggleControllerOnGrab method determines whether the controller should be shown or hidden when grabbing an interactable object.

ToggleControllerOnUse/3

public virtual void ToggleControllerOnUse(bool showController, GameObject usingObject, GameObject ignoredObject)

  • Parameters
  • bool showController - If true then the controller will attempt to be made visible when no longer using, if false then the controller will be hidden on use.
  • GameObject usingObject - The using object to apply the visibility state to.
  • GameObject ignoredObject - The object that is currently being interacted with by the using object which is passed through to the visibility to prevent the object from being hidden as well.
  • Returns
  • none

The ToggleControllerOnUse method determines whether the controller should be shown or hidden when using an interactable object.

Example

VRTK/Examples/008_Controller_UsingAGrabbedObject shows that the controller can be hidden when touching, grabbing and using an object.