x


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.

more ▼

asked Dec 23 '10 at 06:58 AM

james 4 gravatar image

james 4
9 5 5 7

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.)

more ▼

answered Dec 23 '10 at 01:14 PM

Jesus_Freak gravatar image

Jesus_Freak
1.2k 38 44 59

the axes are all right, they're supposed to be like that; the script is ok (as of right now)

Dec 23 '10 at 01:15 PM Jesus_Freak
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2987
x982
x87

asked: Dec 23 '10 at 06:58 AM

Seen: 892 times

Last Updated: Dec 23 '10 at 06:58 AM