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

VRTK_BasePointer

extends VRTK_DestinationMarker

Overview

This abstract class provides any game pointer the ability to know the state of the implemented pointer.

It extends the VRTK_DestinationMarker to allow for destination events to be emitted when the pointer cursor collides with objects.

As this is an abstract class, it cannot be applied directly to a game object and performs no logic.

Inspector Parameters

  • Controller: The controller that will be used to toggle the pointer. If the script is being applied onto a controller then this parameter can be left blank as it will be auto populated by the controller the script is on at runtime.
  • Pointer Origin Transform: A custom transform to use as the origin of the pointer. If no pointer origin transform is provided then the transform the script is attached to is used.
  • Pointer Material: The material to use on the rendered version of the pointer. If no material is selected then the default WorldPointer material will be used.
  • Hold Button To Activate: If this is checked then the pointer beam will be activated on first press of the pointer alias button and will stay active until the pointer alias button is pressed again. The destination set event is emitted when the beam is deactivated on the second button press.
  • Interact With Objects: If this is checked then the pointer will be an extension of the controller and able to interact with Interactable Objects.
  • Grab To Pointer Tip: If Interact With Objects is checked and this is checked then when an object is grabbed with the pointer touching it, the object will attach to the pointer tip and not snap to the controller.
  • Activate Delay: The time in seconds to delay the pointer beam being able to be active again. Useful for preventing constant teleportation.
  • Pointer Visibility: Determines when the pointer beam should be displayed.
  • Layers To Ignore: The layers to ignore when raycasting.

Class Variables

  • public enum pointerVisibilityStates - States of Pointer Visibility.
  • On_When_Active - Only shows the pointer beam when the Pointer button on the controller is pressed.
  • Always_On - Ensures the pointer beam is always visible but pressing the Pointer button on the controller initiates the destination set event.
  • Always_Off - Ensures the pointer beam is never visible but the destination point is still set and pressing the Pointer button on the controller still initiates the destination set event.

Class Methods

IsActive/0

public virtual bool IsActive()

  • Parameters
  • none
  • Returns
  • bool - Is true if the pointer is currently active.

The IsActive method is used to determine if the pointer currently active.

CanActivate/0

public virtual bool CanActivate()

  • Parameters
  • none
  • Returns
  • bool - Is true if the pointer is able to be activated due to the activation delay timer being zero.

The CanActivate method checks to see if the pointer can be activated as long as the activation delay timer is zero.

ToggleBeam/1

public virtual void ToggleBeam(bool state)

  • Parameters
  • bool state - The state of whether to enable or disable the beam.
  • Returns
  • none

The ToggleBeam method allows the pointer beam to be toggled on or off via code at runtime. If true is passed as the state then the beam is activated, if false then the beam is deactivated.