Confine mouse to a plane
Hey, I know that its usually frowned upon to ask vague questions, but there is something I would like to do for a VR project and I honestly have little idea of how to start.
Essentially in this first person game, the player is going to spend most of his time looking at and interacting with an in-game computer monitor. What I'd like to do is have the mouse input of the player move the mouse on this in-game monitor and nowhere else. I understand I can (and probably will need to) disable the hardware mouse with Cursor.visible.
What I'm not sure (at all) how to do is take the mouse input and make it move as if it were a part of the in-game computer. I've tried drawing a software mouse as a UI element that follows the mouse input and is Mathf.Clamped to the position of the computer monitor but it only works well when looking at the monitor from head on (the player will have some camera control so this is an issue).
Any help would be nice. I don't expect or need you guys to write any code for me or whatever but if anyone has an idea of how I should do this logically, it would be super helpful.
Answer by RegularFriend · Nov 11, 2015 at 12:15 AM
this is op:
Is there a way to convert screen position (what the mouse input essentially gives you) to a local position in unity?