Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

Input.MousePosition value reaches maximum value really fast

Hi,

I am currently trying to implement mouse control for the cursor. I have run into a problem that the mouse is really sensitive. And the value of Input.MousePosition goes from 0 to maximum value really fast, so after it is reaching the maximum or minimum value, Input.getAxis() would always return 0. I am currently using Input.getAxis to determine which direction the cursor should be moving. And if it is 0, there is no way for me to determine it anymore.

I faced this problem when I am trying to use a bluetooth mouse with hololens. However, it works fine when I try to use remote holographic tool in Unity.

Does anybody know a solution to this problem or a work around?

Thanks in advance.

Tagged:

Answers

  • @peterFromEarth
    What is the value of Cursor.lockState?

  • I use the OnGUI with success:

           void OnGUI()
            {
                RaycastHit hit;
                Event e = Event.current;
                if (isEnabled)
                {
                    Vector2 mouse = new Vector2(e.mousePosition.x, Screen.height - e.mousePosition.y);
                    Ray ray = Camera.main.ScreenPointToRay(mouse);
                    if (Physics.Raycast(ray, out hit, 100.0f))
                    {
                        transform.position = hit.point;
                    }
                    else
                    {
                        transform.position = ray.direction*2;
                    }
                }
            }
    
Sign In or Register to comment.