- Home /
how to find mouse look
i really need to figure our how to make the camera move with the mouse, but i cannot find mouse look ANYWHERE. i tried someones script and it didnt work, and ive look in basicly every menu possible.
Answer by Jesus_Freak · Dec 23, 2010 at 01:14 PM
to tell ya the truth, my mouse look was messed up, so i made my own JS mouse look script. it's real easy.
just put this script on your player or whatever you want to move with the camera:
var cam : Transform;
function Update() { transform.rotation.y = -cam.localEulerAngles.y; //this should when your camera rotates left, you're player rotates left also... make sure to set cam as the camera you want to rotate!
cam.localEulerAngles.y = Input.mousePosition.x; //i'm messing up the axes because .y rotates the camera along the Screen's x axis.
cam.localEulerAngles.x = Input.mousePosition.y; //same as above, only switched the axis names. }
you don't need this on your camera, actually, this won't work if you put it on your camera. and you have to drag your camera from the heirarchy wiindow to your cam slot in the Inspector.
I hope i helped you!
(as always, if you need anything, or you think i left something out, comment.)
the axes are all right, they're supposed to be like that; the script is ok (as of right now)
Your answer
Follow this Question
Related Questions
Unity Android Movement Problem 0 Answers
weapon bob when looking 2 Answers
Camera movement independent of player control 1 Answer
Camera Rotation 1 Answer
Camera movement question 1 Answer