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

VRTK_Control

Overview

All 3D controls extend the VRTK_Control abstract class which provides a default set of methods and events that all of the subsequent controls expose.

Inspector Parameters

  • Interact Without Grab: If active the control will react to the controller without the need to push the grab button.

Class Variables

  • public ValueChangedEvent OnValueChanged - Emitted when the control is interacted with.
  • public enum Direction - 3D Control Directions
  • autodetect - Attempt to auto detect the axis
  • x - X axis
  • y - Y axis
  • z - Z axis

Class Events

  • ValueChanged - Emitted when the 3D Control value has changed.

Unity Events

Adding the VRTK_Control_UnityEvents component to VRTK_Control object allows access to UnityEvents that will react identically to the Class Events.

  • OnValueChanged - Emits the ValueChanged class event.

Event Payload

  • float value - The current value being reported by the control.
  • float normalizedValue - The normalized value being reported by the control.

Class Methods

GetValue/0

public float GetValue()

  • Parameters
  • none
  • Returns
  • float - The current value of the control.

The GetValue method returns the current value/position/setting of the control depending on the control that is extending this abstract class.

GetNormalizedValue/0

public float GetNormalizedValue()

  • Parameters
  • none
  • Returns
  • float - The current normalized value of the control.

The GetNormalizedValue method returns the current value mapped onto a range between 0 and 100.

SetContent/2

public void SetContent(GameObject content, bool hideContent)

  • Parameters
  • GameObject content - The content to be considered within the control.
  • bool hideContent - When true the content will be hidden in addition to being non-interactable in case the control is fully closed.
  • Returns
  • none

The SetContent method sets the given game object as the content of the control. This will then disable and optionally hide the content when a control is obscuring its view to prevent interacting with content within a control.

GetContent/0

public GameObject GetContent()

  • Parameters
  • none
  • Returns
  • GameObject - The currently stored content for the control.

The GetContent method returns the current game object of the control's content.