public void AssignCameraRig() { if (cameraRig) { Transform t = cameraRig.transform.Find("TrackingSpace"); centerEyeTransform = t.Find("CenterEyeAnchor"); } manager = FindObjectOfType <OVRManager>(); // There has to be an event system for the GUI to work EventSystem eventSystem = GameObject.FindObjectOfType <EventSystem>(); if (eventSystem == null) { Debug.Log("Creating EventSystem"); eventSystem = (EventSystem)GameObject.Instantiate(eventSystemPrefab); } else { //and an OVRInputModule if (eventSystem.GetComponent <OVRInputModule>() == null) { eventSystem.gameObject.AddComponent <OVRInputModule>(); } } inputModule = eventSystem.GetComponent <OVRInputModule>(); cameraRig.EnsureGameObjectIntegrity(); canvas.GetComponent <Canvas>().worldCamera = cameraRig.leftEyeCamera; }
public void AssignCameraRig() { FindPlayerAndCamera(); // There has to be an event system for the GUI to work EventSystem eventSystem = GameObject.FindObjectOfType <EventSystem>(); if (eventSystem == null) { Debug.Log("Creating EventSystem"); eventSystem = (EventSystem)GameObject.Instantiate(eventSystemPrefab); } else { //and an OVRInputModule if (eventSystem.GetComponent <OVRInputModule>() == null) { eventSystem.gameObject.AddComponent <OVRInputModule>(); } } inputModule = eventSystem.GetComponent <OVRInputModule>(); playerController = FindObjectOfType <OVRPlayerController>(); if (playerController) { CachePlayerControlDefaults(); } cameraRig.EnsureGameObjectIntegrity(); canvas.GetComponent <Canvas>().worldCamera = cameraRig.leftEyeCamera; }
void Start() { m_CameraRig = FindObjectOfType <OVRCameraRig>(); m_InputModule = FindObjectOfType <OVRInputModule>(); //TODO using OVRInput.Controller.Hands or OVRInput.Controller.Touch to check whether they use controller or hands }
void Awake() { GameObject eventSystem = GameObject.Find("/UIHelpers/EventSystem"); oim = eventSystem.GetComponent <OVRInputModule>(); gamePlane = GameObject.Find("/GameBoard/GamePlane"); zValue = gamePlane.transform.localPosition.z + zOffset; }
public void OnPointerExit(PointerEventData e) { if (e.IsVRPointer()) { OVRInputModule inputModule = EventSystem.current.currentInputModule as OVRInputModule; inputModule.activeGraphicRaycaster = null; } }
public void OnPointerEnter(PointerEventData e) { if (e.IsVRPointer()) { OVRInputModule ovrinputModule = EventSystem.current.currentInputModule as OVRInputModule; ovrinputModule.activeGraphicRaycaster = this; } }
public void OnPointerEnter(PointerEventData e) { if (e.IsVRPointer()) { // Gaze has entered this canvas. We'll make it the active one so that canvas-mouse pointer can be used. OVRInputModule inputModule = EventSystem.current.currentInputModule as OVRInputModule; inputModule.activeGraphicRaycaster = this; } }
public void OnPointerEnter(PointerEventData e) { PointerEventData ped = e as OVRRayPointerEventData; if (ped != null) { // Gaze has entered this canvas. We'll make it the active one so that canvas-mouse pointer can be used. OVRInputModule inputModule = EventSystem.current.currentInputModule as OVRInputModule; if (inputModule != null) { inputModule.activeGraphicRaycaster = this; } } }
protected virtual void Init() { //panel = GameObject.Find("UIWinGame/Panel"); if (!panel) { Debug.LogError("panel not found in UiWinGame"); } canvas = GetComponent <Canvas>().gameObject; // Setup mouse pointer pointer = GetComponent <OVRMousePointer>(); LockCursor(); CentreMouse(); GameObject playerObject = GameHandler.instance.PlayerController.gameObject; // We use OVRCameraRig to set rotations to cameras, // and to be influenced by rotation OVRCameraRig[] CameraRigs = playerObject.GetComponentsInChildren <OVRCameraRig>(); if (CameraRigs.Length == 0) { Debug.LogWarning("OVRPlayerController: No OVRCameraRig attached."); } else if (CameraRigs.Length > 1) { Debug.LogWarning("OVRPlayerController: More then 1 OVRCameraRig attached."); } else { cameraRig = CameraRigs[0]; if (CameraRigs[0].centerEyeAnchor) { GetComponent <Canvas>().worldCamera = CameraRigs[0].centerEyeAnchor.GetComponent <Camera>(); } } inputModule = FindObjectOfType <OVRInputModule>(); }
/// <summary> /// Is this the currently focussed Raycaster according to the InputModule /// </summary> /// <returns></returns> public bool IsFocussed() { OVRInputModule inputModule = EventSystem.current.currentInputModule as OVRInputModule; return(inputModule && inputModule.activeGraphicRaycaster == this); }
void Start() { m_CameraRig = FindObjectOfType <OVRCameraRig>(); m_InputModule = FindObjectOfType <OVRInputModule>(); }
void Start() { GameObject eventSystem = GameObject.Find("/UIHelpers/EventSystem"); oim = eventSystem.GetComponent <OVRInputModule>(); }