- Home /
how do i make somthing rotate with mouse
hello all iv been looking around for some help on how to make a script on making something rotate with the mouse what i mean is like thing thing the game something like that cause im in the making of a 3d platform game and i want the arms to look at the mouse for the aiming right now im using a script that uses the mouse input to rotate the arms but i want the arms to look at the mouse
example http://img194.imageshack.us/i/runaimfire.png/ http://img713.imageshack.us/i/runaimfire01.png/
the reason it doesn't aim right is cause im using only the y axis so what would i need to do to fix this please help i have no idea how to do this
this is the script im using right now
var verticalSpeed : float = 2.0;
function Update () {
var v : float = verticalSpeed * Input.GetAxis ("Mouse Y");
transform.Rotate ( -v, 0, 0);
}
if you know how this is done please help :)
ps:this game is called run aim fire look it up on you tube if you like it
Why do you double post this? http://answers.unity3d.com/questions/51559/making-and-object-rotate-with-mouse
Answer by Louise 1 · Apr 09, 2011 at 09:10 AM
Hi, I wandering are you using the First Person Controller in the Standard Assets? If you just want the afact in you exsample, the gun will seeing around with your First Person Controller by mouse. Then, parent you gun to it or try to drop the mouselook script on the gun. Hope this can help you.
Your answer
Follow this Question
Related Questions
LookAt mouse, with run animation 1 Answer
how will my camera to move in the direction of dragging? 0 Answers
transform.LookAt gives a twist 2 Answers
Problems with accurate third-person mouse aiming 0 Answers
Object Look At Mouse 2 Answers