Guides
Guides

VRTK_ButtonControl

extends VRTK_ObjectControl

Overview

Provides the ability to control a GameObject's position based the press of a controller button linked to a specific axis direction.

This script forms the stub of emitting the axis X and Y changes that are then digested by the corresponding Object Control Actions that are listening for the relevant event.

Required Components:

  • VRTK_ControllerEvents - The Controller Events script to listen for button presses events on.

Optional Components:

  • VRTK_BodyPhysics - The Body Physics script to utilise to determine if falling is occuring.

Script Usage:

  • Place the VRTK_ButtonControl script on either:
    • The GameObject with the Controller Events script.
    • Any other scene GameObject and provide a valid VRTK_ControllerEvents component to the Controller parameter of this script.
  • Place a corresponding Object Control Action for the Button Control script to notify of axis changes. Without a corresponding Object Control Action, the Button Control script will do nothing.

Inspector Parameters

  • Forward Button: The button to set the y axis to +1.
  • Backward Button: The button to set the y axis to -1.
  • Left Button: The button to set the x axis to -1.
  • Right Button: The button to set the x axis to +1.