- Home /
how to make player looks at mouse
i want to make my player look at the mouse. but i only want it to move in the x axis. can anyone help
Can you edit your post and provide some more detail? Specifically, what it means for the object to 'look at' the mouse, and also what you mean by only moving 'in the x axis'. (It might help if you could point us to a game that uses the type of control scheme you have in $$anonymous$$d.)
Answer by Jesus_Freak · Dec 26, 2010 at 10:50 PM
transform.localEulerAngles.y=Input.mousePosition.x;
Try that out.
Have you actually tried that? It seems very unlikely that that would cause an object to look/aim at the current mouse position.
Yes, actually, I'm using that and more code to rotate a GUI based on mouse position and camera rotation.
Well it rotates based on where the mouse is in camera x axis.
But does it look/aim at the mouse position? (Rotating based on the mouse's x coordinate is very different from 'looking at' the mouse position.)
Right, sorry this acts like a homemade mouseLook script, Or at least half of it.