- Home /
Look On Cursor Problem
I want my character to look on the mouse cursor so I wrote in the Update method: "transform.rotation = Quaternion.Euler(0, Input.mousePosition.x * rotateSpeed, 0);".
the problem is that when the mouse cursor comes to the end of the screen he stop so the player can't keep rotating. Anyone help with that?
Answer by Master_Zen · Aug 12, 2018 at 08:55 PM
You can set the lockState
of the Cursor
to CursorLockMode.None.
to track the mouse position even when the cursor isn't in the games window.
Information took from the documentation: https://docs.unity3d.com/ScriptReference/Cursor-lockState.html
Note: Input.mousePosition reports the position of the mouse even when it is not inside the Game View, such as when Cursor.lockState is set to CursorLockMode.None.