Rotate camera on collision of character
Hi there, im trying to make a C# script for my 2.5d side scrolling game which allows my camera following the players' character to rotate along with the character when it collides with a game object or a box collider (with no colliders so the player can pass through the object).
So as the character follows the path and hits a certain point, the camera and character will rotate 90 degrees along a different axis.
Any help would be appreciated!
Answer by b1gry4n · Apr 10, 2016 at 07:13 AM
put a script on the trigger that does exactly that. It has a reference to the camera and it changes its eulerAngles.
http://docs.unity3d.com/ScriptReference/Transform-eulerAngles.html
Camera.main.transform.eulerAngles = new Vector3(Camera.main.transform.eulerAngles.x, Camera.main.transform.eulerAngles.y, Camera.main.transform.eulerAngles.z + rotateAmount);
Your answer
Follow this Question
Related Questions
Player cannot destroy enemy 1 Answer
Lose Health when GameObject enters collider? (OnTriggerEnter) 2 Answers
Cube wont destroy on collision 0 Answers
Rigid Body and Collision 1 Answer
Player cannot destroy enemy 0 Answers