Assignment for RMIT Mixed Reality in 2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
1.1 KiB

namespace VRTK.Examples
{
using UnityEngine;
public class ModelVillage_TeleportLocation : VRTK_DestinationMarker
{
public Transform destination;
private bool lastUsePressedState = false;
private void OnTriggerStay(Collider collider)
{
VRTK_ControllerEvents controller = (collider.GetComponent<VRTK_ControllerEvents>() ? collider.GetComponent<VRTK_ControllerEvents>() : collider.GetComponentInParent<VRTK_ControllerEvents>());
if (controller != null)
{
if (lastUsePressedState == true && !controller.triggerPressed)
{
float distance = Vector3.Distance(transform.position, destination.position);
VRTK_ControllerReference controllerReference = VRTK_ControllerReference.GetControllerReference(controller.gameObject);
OnDestinationMarkerSet(SetDestinationMarkerEvent(distance, destination, new RaycastHit(), destination.position, controllerReference));
}
lastUsePressedState = controller.triggerPressed;
}
}
}
}