Last active
March 20, 2017 05:04
-
-
Save sam-keene/aa35c34495a35aaca13abf09ca2cb682 to your computer and use it in GitHub Desktop.
Daydream VR: Example of extracting the Raycast Hit Data directly from the GvrLaserPointer for teleporting using the GvrPointerManager, bypassing the EventSystem pattern of GvrPointerInputModule and the hit object's TriggerEvent.
This file contains 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 UnityEngine; | |
using UnityEngine.UI; | |
public class PlayerController : MonoBehaviour { | |
void Update () { | |
if (GvrController.ClickButtonUp) { | |
GvrLaserPointerImpl laserPointerImpl = (GvrLaserPointerImpl)GvrPointerManager.Pointer; | |
if (laserPointerImpl.IsPointerIntersecting) { | |
gameObject.transform.position = new Vector3(laserPointerImpl.PointerIntersection.x, gameObject.transform.position.y, laserPointerImpl.PointerIntersection.z); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment