- Home /
Setting camera pitch - Never works?
Hi all, I have an FPS camera with components Character Controller, Character Motor, Mouse Look and FPS Input Controller.
I want to be able to warp this camera to certain point in the level whenever a key is pressed. The camera spawns at the right location with the correct yaw, but always retains its previous pitch i.e. if I was looking down before I warped, I'm still looking down after I warp. I want to set the camera pitch to 0.
variable "outside" is a transform:
if (Input.GetKeyDown(KeyCode.O))
{
transform.position = outside.position;
transform.rotation = outside.rotation;
}
I think what's happening is that the character controller, or one of the other components, is stopping the character controller rotating on the x axis (so the controller is always upright). When I look up and down in the editor, I can see the transform.rotation.x variable updating, so why can't I set this variable from a script?
Any help appreciated, Simon.
Your answer
Follow this Question
Related Questions
How do I properly rotate an FPS camera with a joystick? 1 Answer
Storing camera angles for a FPS -1 Answers
Platformer game level rotation 0 Answers
Rotating a camera that is already rotated on Z axis 0 Answers
FPS Camera Control rotation limits 1 Answer