- Home /
Mouse Look Help
When ever I move my mouse up the screen goes down. When I move my mouse down my screen goes up. I would like it so that when I move my mouse down my screen goes down with it. If you could fix it that would be lovely. Thank You!
Here is the code:
var lookSensitivity : float = 5;
private var yRotation : float;
private var xRotation : float;
private var currentYRotation : float;
private var currentXRotation : float;
private var yRotationV : float;
private var xRotationV : float;
var lookSmoothDamp : float = 0.1;
function Update () {
yRotation += Input.GetAxis("Mouse X") * lookSensitivity;
xRotation += Input.GetAxis("Mouse Y") * lookSensitivity;
xRotation = Mathf.Clamp(xRotation,-90,90);
currentXRotation = Mathf.SmoothDamp(currentXRotation,xRotation,xRotationV,lookSmoothDamp);
currentYRotation = Mathf.SmoothDamp(currentYRotation,yRotation,yRotationV,lookSmoothDamp);
transform.rotation = Quaternion.Euler(currentXRotation,currentYRotation,0);
}
Answer by iDerpCake · Nov 05, 2015 at 04:42 PM
Guys I figured it out I have to change this line from:
transform.rotation = Quaternion.Euler(currentXRotation,currentYRotation,0);
to:
transform.rotation = Quaternion.Euler(-currentXRotation,currentYRotation,0);
Answer by rchmiel · Nov 05, 2015 at 04:45 PM
xRotation -= Input.GetAxis("Mouse Y") * lookSensitivity;
Your answer
Follow this Question
Related Questions
My camera is not linking with my movement 0 Answers
Automatic Camera Rotation in the 3D Game Kit 0 Answers
Automatic 3rd person camera 1 Answer
Unity - Dancing Ball World camera following and rotating system 1 Answer
How do I rotate my Ball Character with the direction the Camera is looking at. 2 Answers