Guides
Guides

VRTK_TouchpadControl

extends VRTK_ObjectControl

Overview

Provides the ability to control a GameObject's position based on the position of the controller touchpad axis.

This script forms the stub of emitting the touchpad 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 the touchpad events on.

Optional Components:

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

Script Usage:

  • Place the VRTK_TouchpadControl 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 Touchpad Control script to notify of touchpad changes. Without a corresponding Object Control Action, the Touchpad Control script will do nothing.

Inspector Parameters

  • Coordinate Axis: The axis to use for the direction coordinates.
  • Primary Activation Button: An optional button that has to be engaged to allow the touchpad control to activate.
  • Action Modifier Button: An optional button that when engaged will activate the modifier on the touchpad control action.
  • Axis Deadzone: A deadzone threshold on the touchpad that will ignore input if the touch position is within the specified deadzone. Between 0f and 1f.

Example

VRTK/Examples/017_CameraRig_TouchpadWalking has a collection of walls and slopes that can be traversed by the user with the touchpad. There is also an area that can only be traversed if the user is crouching.