Guides
These docs are for v2.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.

Class Events

  • OnValueChanged - Emitted when the control is interacted with.

Event Payload

  • float value - The current value in the context of the control extending this abstract class.
  • float value - The normalized value in the range between 0 and 100 of the control extending this abstract class.

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.