- Home /
Is There a Way to Lock the Cursor to a certain Axis?
I repeat my question, Is there a way to lock the cursor to a certain axis? Say I wanted the x position of the mouse to always be centered, but I want the y position to move freely. Is there a way to do this? If not, please respond with an easy alternative with identical effect.
Answer by TheSOULDev · Sep 01, 2017 at 10:49 PM
If you have a custom cursor, you can Mathf.Clamp the X component of it, where you can limit it to only one or just a few values you want it to be in range of. I don't think you can force the OS cursor to act like that because Unity cannot command it. Lastly, if you don't really have a cursor but only camera movement, you can again Mathf.Clamp the desired movement axis via script.
Your answer
Follow this Question
Related Questions
How to move my cursor to a specific position and then lock it to that position. 0 Answers
Centre cursor - Unity 5 (not locking or making invisible) 1 Answer
How can i make the cursor to only show when i press escape and my IN game menu opens? 0 Answers
Can I lock a cursor without hiding it? 0 Answers