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

VRTK_Lever

extends VRTK_Control

Overview

Attaching the script to a game object will allow the user to interact with it as if it were a lever. The direction can be freely set.

The script will instantiate the required Rigidbody, Interactable and HingeJoing components automatically in case they do not exist yet. The joint is very tricky to setup automatically though and will only work in straight forward cases. If there are any issues, then create the HingeJoint component manually and configure it as needed.

Inspector Parameters

  • Direction: The axis on which the lever should rotate. All other axis will be frozen.
  • Min Angle: The minimum angle of the lever counted from its initial position.
  • Max Angle: The maximum angle of the lever counted from its initial position.
  • Step Size: The increments in which lever values can change.

Example

SteamVR_Unity_Toolkit/Examples/025_Controls_Overview has a couple of levers that can be grabbed and moved. One lever is horizontal and the other is vertical.