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

VRTK_DestinationMarker

Overview

This abstract class provides the ability to emit events of destination markers within the game world. It can be useful for tagging locations for specific purposes such as teleporting.

It is utilised by the VRTK_BasePointer for dealing with pointer events when the pointer cursor touches areas within the game world.

Inspector Parameters

  • Enable Teleport: If this is checked then the teleport flag is set to true in the Destination Set event so teleport scripts will know whether to action the new destination.

Class Events

  • DestinationMarkerEnter - Emitted when a collision with another game object has occurred.
  • DestinationMarkerExit - Emitted when the collision with the other game object finishes.
  • DestinationMarkerSet - Emitted when the destination marker is active in the scene to determine the last destination position (useful for selecting and teleporting).

Unity Events

Adding the VRTK_DestinationMarker_UnityEvents component to VRTK_DestinationMarker object allows access to UnityEvents that will react identically to the Class Events.

  • OnDestinationMarkerEnter - Emits the DestinationMarkerEnter class event.
  • OnDestinationMarkerExit - Emits the DestinationMarkerExit class event.
  • OnDestinationMarkerSet - Emits the DestinationMarkerSet class event.

Event Payload

  • float distance - The distance between the origin and the collided destination.
  • Transform target - The Transform of the collided destination object.
  • RaycastHit raycastHit - The optional RaycastHit generated from when the ray collided.
  • Vector3 destinationPosition - The world position of the destination marker.
  • bool forceDestinationPosition - If true then the given destination position should not be altered by anything consuming the payload.
  • bool enableTeleport - Whether the destination set event should trigger teleport.
  • uint controllerIndex - The optional index of the controller emitting the beam.

Class Methods

SetInvalidTarget/1

public virtual void SetInvalidTarget(VRTK_PolicyList list = null)

  • Parameters
  • VRTK_PolicyList list - The Tag Or Script list policy to check the set operation on.
  • Returns
  • none

The SetInvalidTarget method is used to set objects that contain the given tag or class matching the name as invalid destination targets. It accepts a VRTK_PolicyList for a custom level of policy management.

SetNavMeshCheckDistance/1

public virtual void SetNavMeshCheckDistance(float distance)

  • Parameters
  • float distance - The max distance the nav mesh can be from the sample point to be valid.
  • Returns
  • none

The SetNavMeshCheckDistance method sets the max distance the destination marker position can be from the edge of a nav mesh to be considered a valid destination.

SetHeadsetPositionCompensation/1

public virtual void SetHeadsetPositionCompensation(bool state)

  • Parameters
  • bool state - The state of whether to take the position of the headset within the play area into account when setting the destination marker.
  • Returns
  • none

The SetHeadsetPositionCompensation method determines whether the offset position of the headset from the centre of the play area should be taken into consideration when setting the destination marker. If true then it will take the offset position into consideration.