private void HandleControllerInput() { GameObject hand = GameObject.Find("hand_right"); Ray ray = new Ray(hand.transform.position, hand.transform.forward); RaycastHit hit; if (Physics.Raycast(ray, out hit) == false) { return; } var mouseScroll = Vector2.zero; mouseScroll += OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick); mouseScroll += OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick); Vector2 currentCursorPosition = new Vector2(); currentCursorPosition.x = hit.textureCoord.x; currentCursorPosition.y = 1f - hit.textureCoord.y; if (currentCursorPosition != _prevCursorPosition) { BrowserNative.zfb_mouseMove(_browser.browserId, currentCursorPosition.x, currentCursorPosition.y); } _prevCursorPosition = currentCursorPosition; if (mouseScroll.sqrMagnitude != 0) { BrowserNative.zfb_mouseScroll( _browser.browserId, (int)(mouseScroll.x * _scrollSpeed), (int)(mouseScroll.y * _scrollSpeed) ); } if (OVRInput.GetUp(OVRInput.RawButton.A)) { Debug.Log("click"); BrowserNative.zfb_mouseButton( _browser.browserId , BrowserNative.MouseButton.MBT_LEFT , false , 0 ); } if (OVRInput.GetDown(OVRInput.RawButton.A)) { Debug.Log("down"); BrowserNative.zfb_mouseButton( _browser.browserId , BrowserNative.MouseButton.MBT_LEFT , true , 1 ); } }
void OnMoveOver(RaycastHit hit) { BrowserNative.zfb_mouseMove(_browser.browserId, hit.textureCoord.x, 1 - hit.textureCoord.y); }