How to make Cinemachine camera zoom and rotate when colliding

Hi everyone, I’m working on a split-screen game and would like some guidance on how to achieve this:
https://youtu.be/Goa3Pt_iFNI?t=196

When Cody (player on the right) looks up he has an excellent view of the whole level while still being on screen.

This is instead what I have right now. GIF LINK
What I’m currently using is a Cinemachine FreeLook camera with a Cinemachine Collider extension on it.
If needed I can also share all the settings used on the Cinemachine elements. Maybe the first relevant thing to say is that the “Minimum Distance From Target” on the Cinemachine Collider is set to 0.01.

What I want to basically do is make the camera get closer to the player if collides with something but at the same time rotate it so the player would have a better view of the upper part of the level.

What’s the best way to achieve it?
Thanks!

I wouldn’t depend on the collider for this. Instead, I would set up the FreeLook’s bottom orbit to be really close to the player, below the LookAt spot, so the camera looks up at it, something like this:

Also adjust the ScreenY in the composers of the 3 rigs to position the player where you want it in the frame.

1 Like

Thanks for the answer!!

That’s what I’m doing with the camera for the other player at the moment. The problem in my case is that the character/model for the spider is not “tall” enough to allow me to do so. If I would take your pic as a reference she would be out of sight of the camera.

I don’t know if there’s any better solution to that though, that’s why I asked here :slight_smile:

If the character is very small then you’ll have to do it by adjusting the ScreenY of the bottom rig. If you put it low on the screen, then the camera will be more angled upwards.

You should also make the camera radius small in the CM Collider, to allow the camera to be as close as possible to the floor.

Thanks for the reply. I did so, now the radius of the camera is 0.5 and we achieved something that is what we were aiming for.

I have another question though.
I have now set up a script that changes the camera from one FreeLookCamera to another FreeLookCamera with different rigs but, when that happens, the camera changes but looks up instead. Here’s a GIF LINK that shows the behaviour.

Any idea why this is happening?

Try enabling this on the FreeLook. Does it help?

8940501--1226259--upload_2023-4-11_7-26-11.png

Yes, I already had that set it up but it doesn’t fix the problem

Are the LookAt and Follow targets at the same point? There is a gotcha in FreeLook: if the LookAt and Follow targets do not correspond to the same point, then InheritPosition can sometimes erroneously put the incoming camera on the bottom rig. The workaround is to create an empty child object in the target, positioned at the desired LookAt point, and use it for both LookAt and Follow targets.

Yes, the LookAt and the Follow object are the same. I don’t get why the first transition of the camera works smoothly but the second one doesn’t

Do you have a nonzero TrackedObjectOffset in the freelook Aim?