Camera rotate when player trigger/collide on a object

function OnTriggerEnter( otherGuy : Collider ) {
if (otherGuy.transform.tag == “cameraflip1” ) {
GameObject.FindGameObjectWithTag(“MainCamera”);
transform.Rotate (0,0,180);

ive searched for hours after a answer. Ive tried alot of diffrent things. im very new to scripting.

so i want the maincamera to rotate when the player collide with an object with the tag cameraflip1.
can someone help? :-?
sorry for my bad english.

The code you have would flip the player when it hits the camera and not the camera. You need to rotate the camera and not the player.

Try this:

function OnTriggerEnter(otherGuy : Collider){
if(otherGuy.tag == “cameraflip”){ //you don’t need to use .transform.tag .tag works just fine
Camera.main.transform.rotate(0, 0, 180); //Camera.main is the same thing as GameObject.FindGameObjectWithTag(“MainCamera”)
}
}

Hi, thanks for the answer.
But it still doesnt work. it just doesnt do anything. :frowning: