Guides

Pointer Direction Indicator

Overview

Adds a Pointer Direction Indicator to a pointer renderer and determines a given world rotation that can be used by a Destiantion Marker.

Prefab Usage:

  • Place the VRTK/Prefabs/PointerDirectionIndicator/PointerDirectionIndicator prefab into the scene hierarchy.
  • Attach the PointerDirectionIndicator scene GameObejct to the Direction Indicator inspector parameter on a VRTK_BasePointerRenderer component.

This can be useful for rotating the play area upon teleporting to face the user in a new direction without expecting them to physically turn in the play space.

Inspector Parameters

  • Touchpad Deadzone: The touchpad axis needs to be above this deadzone for it to register as a valid touchpad angle.
  • Coordinate Axis: The axis to use for the direction coordinates.
  • Include Headset Offset: If this is checked then the reported rotation will include the offset of the headset rotation in relation to the play area.
  • Display On Invalid Location: If this is checked then the direction indicator will be displayed when the location is invalid.
  • Use Pointer Color: If this is checked then the pointer valid/invalid colours will also be used to change the colour of the direction indicator.
  • Indicator Visibility: Determines when the direction indicator will be visible.

Class Variables

  • public enum VisibilityState - States of Direction Indicator Visibility.
    • OnWhenPointerActive - Only shows the direction indicator when the pointer is active.
    • AlwaysOnWithPointerCursor - Only shows the direction indicator when the pointer cursor is visible or if the cursor is hidden and the pointer is active.

Class Events

  • PointerDirectionIndicatorPositionSet - Emitted when the object tooltip is reset.

Unity Events

Adding the VRTK_PointerDirectionIndicator_UnityEvents component to VRTK_PointerDirectionIndicator 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.

Class Methods

Initialize/1

public virtual void Initialize(VRTK_ControllerEvents events)

  • Parameters
    • VRTK_ControllerEvents events - The Controller Events script that is used to control the direction indicator's rotation.
  • Returns
    • none

The Initialize method is used to set up the direction indicator.

SetPosition/2

public virtual void SetPosition(bool active, Vector3 position)

  • Parameters
    • bool active - Determines if the direction indicator GameObject should be active or not.
    • Vector3 position - The position to set the direction indicator to.
  • Returns
    • none

The SetPosition method is used to set the world position of the direction indicator.

GetRotation/0

public virtual Quaternion GetRotation()

  • Parameters
    • none
  • Returns
    • Quaternion - The reported rotation of the direction indicator.

The GetRotation method returns the current reported rotation of the direction indicator.

SetMaterialColor/2

public virtual void SetMaterialColor(Color color, bool validity)

  • Parameters
    • Color color - The colour to update the direction indicatormaterial to.
    • bool validity - Determines if the colour being set is based from a valid location or invalid location.
  • Returns
    • none

The SetMaterialColor method sets the current material colour on the direction indicator.

GetControllerEvents/0

public virtual VRTK_ControllerEvents GetControllerEvents()

  • Parameters
    • none
  • Returns
    • VRTK_ControllerEvents - The associated Controller Events script.

The GetControllerEvents method returns the associated Controller Events script with the Pointer Direction Indicator script.