Hello everyone, I have specific behavior in mind for how I want my cinemachine camera to act, but I have not found a way to do this yet.
I want the camera to avoid clipping into physical objects, but allow physical objects to obstruct the view of the target. Basically the way a camera would work in real life. By default the camera will clip through objects, and adding the collider extension which prevents this will also force the camera to zoom way in if the target is blocked. Does anyone know how to stop the camera from clipping into things while still allowing obstructions?
This feature exists in CInemachine 3.1. CM 3.1 is compatible with Unity 2022.3 and up. With it, you can use the CInemachineDecollider extension.
Note that you should not upgrade your project without due consideration, as it may require some work on your part. Please see our upgrade guide here: Upgrading a Project from Cinemachine 2.X | Cinemachine | 3.1.2
Thank you for the advice! We’re almost there!
I successfully updated the project to use CM 3.1 and added the decollider extension. It now avoids clipping while allowing obstructions as I requested. HOWEVER, the corrective behavior now involves moving the camera directly up in world space rather than pulling forward like it did with CM 2. Is there a way to restore the pulling forward behavior? I was only able to do so by turning on “avoid obstacles” in the deoccluder extension, but that forced the camera to not allow obstructions again.
The decollider will put the camera on top of terrains, and pull it in front of obstacles. Make sure you are using the “Decollision” section and not the “Terrain Resolution” section.
Awesome! It needs more fine-tuning but I can take it from here, thank you so much!
1 Like