Using the Camera Triggers in Unity

This tutorial will cover how to use camera triggers to adjust your camera angles in Unity. Do to this you should already have your camera triggers and your camera angles set up. Create a script called CameraTrigger. Assign it to all of your camera triggers. Also make sure all of your camera triggers have a rigid body and uncheck Use Gravity on them. Also Make to to check Is Trigger. Otherwise they will not actually trigger.

Open the script you just created. You will not need the start or update functions so you can remove those. Add an OnTriggerEnter function and check if the other collider has the Player tag.

Next, create a variable that will hold the transform for the camera position you want to switch to.

Then assign the cameras to each of your triggers.

Next in your script update the main camera to match the transform and rotation of your camera transform that is attached to the trigger.

Now as your player moves through the game the camera will adjust as you move through the triggers.




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store