Skip to content

Instantly share code, notes, and snippets.

@sam-keene
Created April 7, 2017 04:32
Show Gist options
  • Save sam-keene/dd26677570c3528000549e3c4bf326b7 to your computer and use it in GitHub Desktop.
Save sam-keene/dd26677570c3528000549e3c4bf326b7 to your computer and use it in GitHub Desktop.
Part of a Medium tutorial on building a multiplayer game in Daydream VR and Unity
using System.Collections;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
public class TeleportEvent : UnityEvent<Vector3>
{
}
public class SDKBoyTeleportController : MonoBehaviour {
public TeleportEvent teleportEvent;
void Start()
{
if (teleportEvent == null) {
teleportEvent = new TeleportEvent ();
}
}
public void TeleportTo(BaseEventData data ) {
PointerEventData pointerData = data as PointerEventData;
Vector3 worldPos = pointerData.pointerCurrentRaycast.worldPosition;
teleportEvent.Invoke(worldPos);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment