void FixedUpdate() { //OVRInput.FixedUpdate(); if (AppModeManager.Instance.appMode == AppModeManager.AppMode.rotate) { if (InputManager.Instance.GetKey(InputManager.ControllerInput.btn_touchpad)) { Quaternion q = OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTrackedRemote); //q.Set(q.x * -1, q.y * -1, q.z, q.w); //transform.rotation = Quaternion.Slerp(transform.rotation, q, 1.0f * ); //transform.eulerAngles = q.eulerAngles; float speed = 100.0f; transform.Rotate(q.x * speed * Time.deltaTime, -q.y * speed * Time.deltaTime, q.z * speed * Time.deltaTime, Space.World); if (runOnce) { Debug.Log("Disable collider once"); EnableColliderOnDataPointEvent(false); runOnce = false; } } else { if (!runOnce) { Debug.Log("Enable collider once"); EnableColliderOnDataPointEvent(true); DataInstance3D.SliderChangedEvent(120, 180); runOnce = true; } } } //if (InputManager.Instance.GetKeyUp(InputManager.ControllerInput.btn_touchpad)) //{ // //EnableColliderOnDataPointEvent(true); // //Debug.Log("Touchpad botton Up"); //} //if (InputManager.Instance.GetKeyDown(InputManager.ControllerInput.btn_touchpad)) //{ // EnableColliderOnDataPointEvent(false); // Debug.Log("Touchpad botton Down"); //} //if (InputManager.Instance.GetKeyUp(InputManager.ControllerInput.mouse)) //{ // EnableColliderOnDataPointEvent(true); //} //if (InputManager.Instance.GetKeyDown(InputManager.ControllerInput.mouse)) //{ // EnableColliderOnDataPointEvent(false); //} }
private void LateUpdate() { if (InputManager.Instance.GetKey(InputManager.ControllerInput.btn_back)) { lr.material.SetColor("_TintColor", TiggerColor); } else { lr.material.SetColor("_TintColor", InitLineColor); } Quaternion rotation = GetLocalControllerRotation(ControllerInfo.CONTROLLER); Vector3 position = GetLocalControllerPosition(ControllerInfo.CONTROLLER); Vector3 pointerOrigin = ControllerInfo.TRACKING_SPACE.position + position; Vector3 pointerProjectedOrientation = ControllerInfo.TRACKING_SPACE.position + (rotation * ControllerInfo.TRACKING_SPACE.forward); //(rotation * Vector3.forward); PointerEventData pointerData = new PointerEventData(EventSystem.current); Vector3 pointerDrawStart = pointerOrigin - pointerProjectedOrientation * 0.05f; Vector3 pointerDrawEnd = pointerDrawStart + (gazePointerIcon.transform.position - pointerDrawStart).normalized * 1.5f; //pointerOrigin + pointerProjectedOrientation * 500.0f; //gazePointerIcon.transform.position;// pointerLine.SetPosition(0, pointerDrawStart); pointerLine.SetPosition(1, pointerDrawEnd); tempPointerVals.transform.position = pointerDrawStart; tempPointerVals.transform.rotation = rotation; Vector3 dir = pointerDrawEnd - pointerDrawStart; RaycastHit hit; if (Physics.Raycast(pointerDrawStart, dir, out hit, Mathf.Infinity, layer_mask)) { HitObject = hit.collider.gameObject; Pointer.SetActive(true); Pointer.transform.position = hit.point; //Debug.Log("Hit Object : " + HitObject.name); if (PreviousHitObject == null) { PreviousHitObject = HitObject; Debug.Log("Set previous hit object : " + PreviousHitObject.name); } //if hitting data if (HitObject.layer == 8) { //DataPoints dp = HitObject.GetComponent<DataPoints>(); //if(InputManager.Instance.GetKey(InputManager.ControllerInput.btn_tigger)) //{ // dp.FocusOnData2(); //} ////dp.ShowLabel(); //dp.OnPointerStay(); DataInstance3D instance3D = HitObject.GetComponent <DataInstance3D>(); instance3D.OnPointerEnter(); if (InputManager.Instance.GetKey(InputManager.ControllerInput.btn_tigger)) { instance3D.OnMouseDownSimulated(); } } if (HitObject.layer == 9) { ShowSatelliteInfo sInfo = HitObject.GetComponent <ShowSatelliteInfo>(); if (InputManager.Instance.GetKeyUp(InputManager.ControllerInput.btn_tigger)) { sInfo.TurnOnOFF(); } sInfo.ShowInfo(); } if (HitObject.layer == 11) { // if(OVRInput.Get(OVRInput.Button.PrimaryIndexTrigger, OVRInput.Controller.RTrackedRemote)) // DragObject = HitObject; } if (PreviousHitObject != HitObject) { if (PreviousHitObject.GetComponent <DataInstance3D>()) { PreviousHitObject.GetComponent <DataInstance3D>().OnPointerExit(); } PreviousHitObject = HitObject; } } else { HitObject = null; Pointer.SetActive(false); } }