Point and click camera switch in Unity

Daniel Kirwan
2 min readJun 17, 2021

--

Objective: Switch between different camera angles when the player moves through a trigger

For this article to move along quickly I have already created my gameobjets with the camera positions and rotations that I would like, I also set up the trigger positions with both the trigger selected and added a rigid body with the gravity unticked. At least one game object needs a rigid body for a collision to be detected.

This is all done with one script that changes the main camera position and rotation when the player enters the trigger collider.

I created one variable that is for the game object position that the camera needs to change to. I added the script to each trigger game object and then dragged in the relevant game object that will hold the new camera position and rotation.

The script is relatively simple in its execution. There is one variable which holds the camera position to change to and the ontrigger method makes sure that the object being collided with is the Player.

It then changes the main cameras position and rotation to that of the variable object.

And that is it for switching between camera angles using triggers.

--

--

Daniel Kirwan
Daniel Kirwan

No responses yet