- Home /
unknown axis of rotation
How do I access the transform rotation axis for looking up/down. I can't find that anywhere in the docs or help resources. I need my first person Javascript to slowly force an upward or downward look.
Answer by whydoidoit · Oct 10, 2012 at 06:48 AM
Tilting the camera up or down is a rotation around transform.right
transform.rotation = Quaternion.AngleAxis(someNumberOfDegrees,
transform.right) * transform.rotation;
$$anonymous$$ike, thank you for the amazingly fast response. I will try it out tomorrow.
@doug, be sure to TIC$$anonymous$$ any useful answers to keep the board tidy cheers
sorry about that, man !! (surely not a bug on this web site ?! :o )
@whydoidoit $$anonymous$$ike, Thank you. That command successfully rotates my player's view up or down, but it also causes later horizontal rotations to tilt the player. How do I revert the right & left rotations to not tilt? I tried following your command with transform.rotation = Quaternion.AngleAxis(0, transform.forward) transform.rotation; transform.rotation = Quaternion.AngleAxis(0, transform.up) transform.rotation; but neither helped. Any suggestions?
Your answer
Follow this Question
Related Questions
Reverse Look up ( have transform want the gameObject of that transform) 2 Answers
Setting Up Vector and Still Rotating the Character 1 Answer
how do i fix my script in the content below? 0 Answers
How do I make gameObject.transform.rotation.z equal to a set float value? 2 Answers
Get the Vector position of the player object when clicking another object C# 1 Answer