Updating from Cinemachine 2 to 3.1 and having some issues

Hi there! I migrated my project from Unity 2022.3.24f1 to Unity 6.0 and I was using a Cinemachine 2 camera controlled with some code, I was using the freelook camera set up for a 3rd person player controller. However at some point I saw some trouble with my code at some point and decided to upgrade with Cinemachine 3.1.

In Cinemachine 2 I was using the collider for the camera and it was working great, I could control my camera and it would come closer to the player on collision. I thought that it would be similar with the deoccluder or with the decollider, however no matter what settings I use the camera tries to avoid collision, but it does so changing its behavior.

Right now I am using a Cinemachine camera with Orbital Follow and Rotation Composer and what happens on collision (when it does something) is that it tries to orbit away to the sides, getting inside objects geometry even if they have a collider, and rotates the camera not looking at my target, and if I have a terrain it clamps to the terrain AND then it goes through it.

I have tried changing the strategy to Pull Camera Forward, Preserve Camera Distance and Preserve Camera Height, but I don’t see a real difference.

Now I am starting to miss the Collider from Cinemachine 2 :sweat_smile:

Can you show the inspector for the CM camera, with all the components?

Sure. Here are the components:

I am using the old input system as the input manager is a little overwhelming for me

Normally I use the deoccluder as, according to the documentation that was the equivalent to the old collider

It doesn’t have a tracking target as I control the Tracking target with a script in my player object, checking if the reference to the camera is null on Awake() and setting it to a focal point in the player object.

It would seem that the Deoccluder is set up to ignore all obstacles. You need to tell it which layers to consider:

Also, it’s hard to tell from the images alone, but I get the impression that the Camera component and the CinemachineCamera component are on the same GameObject. Is that the case? If so, it’s wrong and you need to separate them.

1 Like

Oh I see! Indeed both the Camera and Audio listener along with the Cinemachine components (except for the Cinemachine Brain) are in the same game object. I will create a new Cinemachine Freelook camera independent and work on it, I’ll update on anything it happens, thank you very much!

EDIT: Yep! It was me being silly, the thing is that the Cinemachine Brain was yet another different game object when I created the Freelook Camera, so I deleted it and added the Cinemachine Brain Component to my Main Camera and now it works! Again, thank you very much :man_bowing:

1 Like