- Home /
Question by
derrtyones · Nov 14, 2012 at 06:53 PM ·
camerarotationjavascript
Rotating Main Camera
Hi,
I'm using a First Person Controller. What I wish to accomplish is to look around corners by pressing the Q/E buttons.
I thought this would be simple by changing the Z-rotation from the Main Camera to 10.0 but that doesn't seem to do anything. Even if I change it in the inspector itself, it does show the change in the Game view but it doesn't when I hit play.
Any idea's?
Comment
Best Answer
Wiki
Answer by GerryM · Nov 14, 2012 at 07:17 PM
Could something like this work?
if (Input.GetKeyDown(KeyCode.Q))
{
transform.RotateAroundLocal(Vector3.forward, 0.2f);
}
if (Input.GetKeyUp (KeyCode.Q))
{
transform.RotateAroundLocal(Vector3.forward, -0.2f);
}