Created
April 7, 2017 04:32
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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