Cinemachine: Fixing Cameras Ghosting Through Objects

Ryan McCoach
2 min readAug 21, 2022

--

Intro

In this article, we are going to cover how to fix the camera going through objects and walls, instead it will detect collisions and move accordingly.

Camera w/o Cinemachine Collider vs. Camera w. Cinemachine Collider

Cinemachine Collider

Cinemachine offers an extension for the virtual cameras that can easily detect when it collides into anthoer object.

The Cinemachine Collider needs a Look At target to work.

If the camera only doesn’t have a Look At object, you can simply add one without having it effect the main camera settings.

Assign the Look At object and since the Aim setting focuses on the Look At object you can set it to Do Nothing. This will have none of the Aim settings being applied to the camera.

The Cinemachine Collider script default settings will probably solve the problem, but if it doesn’t…

here is the documentation from Unity about these settings. This will customize how the camera will move when it detects a collision, when it detects as a collisions and what objects it can collide with.

--

--