Intelligent Camera Switching Using Clearshot Cameras!
Objective: Understanding the functionality of Cinemachine Clearshot Cameras!
Clearshot cameras are cameras that are supposed to be a more intelligent way to cycle through cameras not based on trigger but based on the visibility of your object.
Let’s create a couple of walls to block off the view from the cameras.
What’s going to happen is, as the player is moving from one area to the next we are going to swap cameras from one to the other. We are not going to use any coding for this we are just using the Cinemachine cameras.
Position your cameras. Make sure to but your object as the LookAt object. For this tutorial we don’t need to worry about following, these are going to be stationary cameras.
Now we can create the clearshot camera.
By default it creates a child camera. We can take our already positioned cameras and child them under the clearshot camera.
You will see a warning triangle. This is because our virtual cameras are missing a collider extension.
We need to make sure that the avoid obstacles is enabled. If we don’t we won’t have any clearshot cutting.
Once that is set all we need to do is press play and move your character out of sight and watch the camera switch.
Now you can create intelligent camera switching with clearshot cameras. Don’t be afraid to experiment with your cameras and I’ll see you in the next tutorial!