How can I handle a third-person camera occlusion around a character's head?

The Problem:

I wanted to make a third person camera similar to how it is in most games, where the player can approach the walls to get a closer look at the character’s face without the camera getting inside of said character.

I set up a Cinemachine Camera and gave it the minimum distance (0.6f) it should have from the character so it wouldn’t get inside him. However, now the camera keeps that distance from the character by going up whenever it gets into an occlusion, no matter what ‘Strategy’ I choose in the Cinemachine Collider component.

What should I do? Does the Cinemachine package features something to handle this? Here is a video demonstrating the issue and some images showing the configuration of my components:

Video:

ytqt4x
Alternative link: Question.mp4

CinemachineVirtualCamera Component:

Player Components:

We have not seen this problem before, of the camera getting stuck inside the character. Would you be willing to send me your test project?

Sure: https://www.dropbox.com/s/whltvdmavnmfle6/Experiments-main.zip?dl=0

I removed the minimum distance I set so you can see the camera getting inside the player model when getting too close to a wall. It’s not that the camera gets stuck inside the player, it’s just that it clips him.

To be more specific, this is what I got vs what I wanted to achieve:
vm34u6

So what do you want the camera to do in this case? Go into the wall?

The camera behavior is correct. The problem in your case is that the camera near clip distance is too high and the character collision+animation allows its head to get far too close to the wall.

1 Like

Why don’t you just reduce the near clip distance?

As for the character getting too close to the wall, that’s a character controller issue, not a camera issue. You can enlarge the radius of the capsule around the character.

1 Like

I didn’t know how to handle this at the time, so I wanted to know how people handled it.

Wow, I didn’t know about this property. I got it working now, thank you!

1 Like