Guides
Guides

VRTK_BaseControllable

Overview

Provides a base that all Controllables can inherit from.

Script Usage:

This is an abstract class that is to be inherited to a concrete class that provides controllable functionality, therefore this script should not be directly used.

Inspector Parameters

  • Operate Axis: The local axis in which the Controllable will operate through.
  • Ignore Collisions With: A collection of GameObjects to ignore collision events with.
  • Exclude Collider Check On: A collection of GameObjects to exclude when determining if a default collider should be created.
  • Equality Fidelity: The amount of fidelity when comparing the position of the control with the previous position. Determines if it's equal above a certain decimal place threshold.

Class Variables

  • public enum OperatingAxis - The local axis that the Controllable will be operated through.
    • xAxis - The local x axis.
    • yAxis - The local y axis.
    • zAxis - The local z axis.

Class Events

  • ValueChanged - Emitted when the Controllable value has changed.
  • RestingPointReached - Emitted when the Controllable value has reached the resting point.
  • MinLimitReached - Emitted when the Controllable value has reached the minimum limit.
  • MinLimitExited - Emitted when the Controllable value has exited the minimum limit.
  • MaxLimitReached - Emitted when the Controllable value has reached the maximum limit.
  • MaxLimitExited - Emitted when the Controllable value has exited the maximum limit.

Unity Events

Adding the VRTK_BaseControllable_UnityEvents component to VRTK_BaseControllable object allows access to UnityEvents that will react identically to the Class Events.

  • All C# delegate events are mapped to a Unity Event with the On prefix. e.g. MyEvent -> OnMyEvent.

Event Payload

  • Collider interactingCollider - The Collider that is initiating the interaction.
  • VRTK_InteractTouch interactingTouchScript - The optional Interact Touch script that is initiating the interaction.
  • float value - The current value being reported by the controllable.
  • float normalizedValue - The normalized value being reported by the controllable.

Class Methods

AtMinLimit/0

public virtual bool AtMinLimit()

  • Parameters
    • none
  • Returns
    • bool - Returns true if the Controllable is at it's minimum limit.

The AtMinLimit method returns whether the Controllable is currently at it's minimum limit.

AtMaxLimit/0

public virtual bool AtMaxLimit()

  • Parameters
    • none
  • Returns
    • bool - Returns true if the Controllable is at it's maximum limit.

The AtMaxLimit method returns whether the Controllable is currently at it's maximum limit.

GetOriginalLocalPosition/0

public virtual Vector3 GetOriginalLocalPosition()

  • Parameters
    • none
  • Returns
    • Vector3 - A Vector3 of the original local position.

The GetOriginalLocalPosition method returns the original local position of the control.

GetOriginalLocalRotation/0

public virtual Quaternion GetOriginalLocalRotation()

  • Parameters
    • none
  • Returns
    • Quaternion - A quaternion of the original local rotation.

The GetOriginalLocalRotation method returns the original local rotation of the control.

GetControlColliders/0

public virtual Collider[] GetControlColliders()

  • Parameters
    • none
  • Returns
    • Collider[] - The Colliders array associated with the control.

The GetControlColliders method returns the Colliders array associated with the control.

GetInteractingCollider/0

public virtual Collider GetInteractingCollider()

  • Parameters
    • none
  • Returns
    • Collider - The Collider currently interacting with the control.

The GetInteractingCollider method returns the Collider of the GameObject currently interacting with the control.

GetInteractingTouch/0

public virtual VRTK_InteractTouch GetInteractingTouch()

  • Parameters
    • none
  • Returns
    • VRTK_InteractTouch - The Interact Touch script currently interacting with the control.

The GetInteractingTouch method returns the Interact Touch script of the GameObject currently interacting with the control.