That’s all it should take. But, the Y difference is always off by 16 pixels. Also, the X difference rarely goes beyond 0, no matter how fast I move my mouse. Clearly, Screen.lockCursor isn’t at the actual center screen, as advertised. It is doing something else completely.
Why doesn’t it work?
(Spending an hour trying to make three lines of code work and 20 minutes having unityAnswers site refuse to log me in, on top of that, it is eating up my lunch time. This makes me one unhappy camper.)
Screen.lockCursor is a bit glitchy in both WebPlayer and the Unity Editor itself but it kinda works in StandAlone version. I would suggest writing a bit more advanced mouselook script to make it less buggy.
private var xtargetRotation : float=10;
private var ytargetRotation : float=10;
var xSensitivity : float=7;
var ySensitivity : float=6;
This one is mine and it works like a real head. The body rotates just in the Y axis and camera in the X one. But if you wan’t it as one object then change the code where i set the rotation. To set it up just make a player, parent a camera to it and just add this to the camera.