- Home /
Mouse Orbit Limit Problems
Hello, i try to create a script which allows me to orbit around the player unit, but this way the mouse cant be locked, and once it hit the screenborder it stops its function, how can i improve this or fix this issue?
CurrentPos = Input.mousePosition;
RDif = CurrentPos.x - LastPos.x;
YDif = CurrentPos.y - LastPos.y;
if(!Cam&&Player)
{
print("Player or Camera is not assigned");
return;
}
RoundCord += RDif; //Cos/Sin @ X/Z = Orbit
Cam.transform.position=new Vector3(Mathf.Cos(RoundCord*Sensibility/1000)*Distance,Player.transform.position.y,Mathf.Sin(RoundCord*Sensibility/1000)*Distance
)+Player.transform.position;
LastPos = CurrentPos;
}
Comment
Best Answer
Answer by alwayscodeangry · Jul 19, 2014 at 09:47 PM
You can use Input.GetAxis()
to get the raw deltas for the mouse X and Y axes, even when the mouse is at screen boundaries. Try:
RDif = Input.GetAxis("Mouse X");
YDif = Input.GetAxis("Mouse Y");
Your answer
Follow this Question
Related Questions
Mouse Orbit - Change From Mouse, to Keys 1 Answer
Mouse Orbit snapping issues 0 Answers
menu issue and mouse click 0 Answers
Locking cursor without changing position 1 Answer
Geometry Wars game experience in Unity 2 Answers