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;

}

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");

Damn that easy :confused: thank you anyway, made my day :slight_smile: