- Home /
Set Rotation Angle
I know this will sound very simple, but how do you set the angle of an object instead of a continuous rotation like Rotate(). I want to figure out the angle the mouse is from the center of the screen and set the y angle of an object to that mouse's angle.
Answer by Jesse Anders · Jan 19, 2011 at 01:38 AM
To set an object's rotation 'from scratch', you can make an assignment to the Transform 'rotation', 'localRotation', 'eulerAngles', or 'localEulerAngles' field, whichever is appropriate.
Unless the object is a child object of another object, you'll probably want to use 'rotation' or 'eulerAngles'. Of these, 'eulerAngles' is probably closest to what you want, as it allows you to specify the angles of rotation directly without any intermediate steps.
Your answer
Follow this Question
Related Questions
Rotation angle from one object to another 5 Answers
Set rotation based on 2 points problem 1 Answer
How do I call a function containing a while loop, inside the update function? 2 Answers
Axis are not rotated as expected 0 Answers
How to rotate a character facing direction of movement like sonic the hedgehog 2 Answers