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

VRTK_SpringLever

extends VRTK_Lever

Overview

This script extends VRTK_Lever to add spring force toward whichever end of the lever's range it is closest to.

The script will instantiate the required Rigidbody, Interactable and HingeJoint 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

  • Spring Strength: The strength of the spring force that will be applied upon the lever.
  • Spring Damper: The damper of the spring force that will be applied upon the lever.
  • Snap To Nearest Limit: If this is checked then the spring will snap the lever to the nearest end point (either min or max angle). If it is unchecked, the lever will always snap to the min angle position.
  • Always Active: If this is checked then the spring will always be active even when grabbing the lever.