Guides

VRTK_ControllerTrackedCollider

extends VRTK_SDKControllerReady

Overview

Provides a controller collider collection that follows the controller rigidbody via the physics system.

Required Components:

  • VRTK_InteractTouch - An Interact Touch script to determine which controller rigidbody to follow.

Optional Components:

  • VRTK_ControllerEvents - The events component to listen for the button presses on. This must be applied in the same object hierarchy as the Interact Touch script if one is not provided via the Controller Events parameter.

Script Usage:

  • Place the VRTK_ControllerTrackedCollider script on any active scene GameObject except the Script Alias objects.
  • Assign the controller to track by applying an Interact Touch to the relevant Script Alias and then providing that reference to the Interact Touch parameter on this script.

Inspector Parameters

  • Interact Touch: The Interact Touch script to relate the tracked collider to.
  • Max Resnap Distance: The maximum distance the collider object can be from the controller before it automatically snaps back to the same position.
  • Activation Button: The button to press to activate the colliders on the tracked collider set. If Undefined then it will always be active.
  • Controller Events: An optional Controller Events to use for listening to the button events. If this is left blank then it will attempt to be retrieved from the same controller as the Interact Touch parameter.

Class Methods

ToggleColliders/1

public virtual void ToggleColliders(bool state)

  • Parameters
    • bool state - If true then the tracked colliders will be able to affect other Rigidbodies.
  • Returns
    • none

The ToggleColliders method toggles the collision state of the tracked colliders.

TrackedColliders/0

public virtual Collider[] TrackedColliders()

  • Parameters
    • none
  • Returns
    • Collider[] - A Collider array of the tracked colliders.

The TrackedColliders method returns an array of the tracked colliders.