Skip to content

Instantly share code, notes, and snippets.

@sam-keene
Last active March 20, 2017 05:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sam-keene/aa35c34495a35aaca13abf09ca2cb682 to your computer and use it in GitHub Desktop.
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.
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