- Home /
Question by
Srinivas141290 · Jan 13, 2014 at 06:17 AM ·
cameracamera-look
How to make the second camera rotate automatically?
I have a camera following the player. Once the player has completed an event, (say for example player has fallen down) I need the second camera to rotate and show the surrounding environment.
Comment
Best Answer
Answer by Quillicit · Jan 13, 2014 at 08:17 AM
Something like this should work:
public float _rotSpeed = 5.0f;
private float _cam2NewAngle;
void Update () {
if(MyEvent){
Cam2Rotate();
}
}
void Cam2Rotate(){
_cam2NewAngle = _rotSpeed * Time.deltaTime;
gameObject.transform.Rotate(0, 0, _cam2NewAngle, Space.Self);
}
Will I have to place this code to the second camera or the player?
This would be on the second camera. The "$$anonymous$$yEvent" part is whatever you want to trigger the rotation, e.g. the player falling down.
Your answer
Follow this Question
Related Questions
Camera gets stuck when cursor is locked 0 Answers
Mouselook in space, without a 'down' or 'up' 1 Answer
What kind of Camera is this? 0 Answers