- Home /
Directional mouse movement independent from position?
I'm trying to get the directional mouse movement. I got that achieved by finding out where the mouse position is. However, when the cursor reaches the edge of the screen the cursor stops moving therefore no longer able to track the direction. I'll eventually need the cursor to be invisible. So tracking the position should still work but, again, it'll reach the edge of the screen and stop.
I figure use GetAxis but that will return back to zero when the mouse stops moving which I don't want. I want to click, hold, drag and track which direction I am dragging. Anyone have a thought?
Thank you.
Answer by dre38w · Oct 09, 2012 at 06:23 PM
Got it!! All I had to do was add the values of the GetAxis to a variable and clamp it between a desired number.
mouseDir += Input.GetAxis("Boost") * mouseSensitivity;
mouseDir = Mathf.Clamp(mouseDir, 0.0f, dragDistance);
Pretty simple. haha