Guides

VRTK_DestinationMarker

Overview

Provides a base that all destination markers can inherit from.

Script Usage:

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

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.
  • Target List Policy: A specified VRTK_PolicyList to use to determine whether destination targets will be considered valid or invalid.

Class Events

  • DestinationMarkerEnter - Emitted when a collision with another collider has first occurred.
  • DestinationMarkerExit - Emitted when the collision with the other collider ends.
  • 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.

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

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.
  • Quaternion? destinationRotation - The world rotation 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.
  • VRTK_ControllerReference controllerReference - The optional reference to the controller controlling the destination marker.

Class Methods

SetNavMeshData/1

public virtual void SetNavMeshData(VRTK_NavMeshData givenData)

  • Parameters
    • VRTK_NavMeshData givenData - The NavMeshData object that contains the NavMesh restriction settings.
  • Returns
    • none

The SetNavMeshData method is used to limit the destination marker to the scene NavMesh based on the settings in the given NavMeshData object.

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.

SetForceHoverOnRepeatedEnter/1

public virtual void SetForceHoverOnRepeatedEnter(bool state)

  • Parameters
    • bool state - The state of whether to force the hover on or off.
  • Returns
    • none

The SetForceHoverOnRepeatedEnter method is used to set whether the Enter event will forciably call the Hover event if the existing colliding object is the same as it was the previous enter call.