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

VRTK_HeadsetControllerAware

Overview

The purpose of Headset Controller Aware is to allow the headset to know if something is blocking the path between the headset and controllers and to know if the headset is looking at a controller.

Inspector Parameters

  • Track Left Controller: If this is checked then the left controller will be checked if items obscure it's path from the headset.
  • Track Right Controller: If this is checked then the right controller will be checked if items obscure it's path from the headset.
  • Controller Glance Radius: The radius of the accepted distance from the controller origin point to determine if the controller is being looked at.
  • Custom Right Controller Origin: A custom transform to provide the world space position of the right controller.
  • Custom Left Controller Origin: A custom transform to provide the world space position of the left controller.

Class Events

  • ControllerObscured - Emitted when the controller is obscured by another object.
  • ControllerUnobscured - Emitted when the controller is no longer obscured by an object.
  • ControllerGlanceEnter - Emitted when the controller is seen by the headset view.
  • ControllerGlanceExit - Emitted when the controller is no longer seen by the headset view.

Unity Events

Adding the VRTK_HeadsetControllerAware_UnityEvents component to VRTK_HeadsetControllerAware object allows access to UnityEvents that will react identically to the Class Events.

  • OnControllerObscured - Emits the ControllerObscured class event.
  • OnControllerUnobscured - Emits the ControllerUnobscured class event.
  • OnControllerGlanceEnter - Emits the ControllerGlanceEnter class event.
  • OnControllerGlanceExit - Emits the ControllerGlanceExit class event.

Event Payload

  • RaycastHit raycastHit - The Raycast Hit struct of item that is obscuring the path to the controller.
  • uint controllerIndex - The index of the controller that is being or has been obscured or being or has been glanced.

Class Methods

LeftControllerObscured/0

public bool LeftControllerObscured()

  • Parameters
  • none
  • Returns
  • bool - Returns true if the path between the headset and the controller is obscured.

The LeftControllerObscured method returns the state of if the left controller is being obscured from the path of the headset.

RightControllerObscured/0

public bool RightControllerObscured()

  • Parameters
  • none
  • Returns
  • bool - Returns true if the path between the headset and the controller is obscured.

The RightControllerObscured method returns the state of if the right controller is being obscured from the path of the headset.

LeftControllerGlanced/0

public bool LeftControllerGlanced()

  • Parameters
  • none
  • Returns
  • bool - Returns true if the headset can currently see the controller within the given radius threshold.

the LeftControllerGlanced method returns the state of if the headset is currently looking at the left controller or not.

RightControllerGlanced/0

public bool RightControllerGlanced()

  • Parameters
  • none
  • Returns
  • bool - Returns true if the headset can currently see the controller within the given radius threshold.

the RightControllerGlanced method returns the state of if the headset is currently looking at the right controller or not.

Example

VRTK/Examples/029_Controller_Tooltips displays tooltips that have been added to the controllers and are only visible when the controller is being looked at.