Collider damping in the new 3rd Person Follow?

I’d like to have control over the collider function of the new 3rd Person Follow. I tried using CinemachineCollider to adjust many things including occluder / damping with the new 3rd Person Follow but it’s causing bugs, making the camera move away and jitter. Is there a way to adjust the occluder damping in and out of 3rd Person Follow?

Currently there is no setting for that. What other specific things are you looking to adjust?

I wanted to add Damping and Damping when Occluded so the camera doesn’t snap when there’s a wall blocking

While the ThirdPersonFollow component is not designed to work with CMCollider, I did give it a try in the AimingRig sample scene. First, I disabled the built-in obstacle avoidance:

6608500--751930--upload_2020-12-10_10-9-31.png

Then, I set a LookAt target because the CMCollider needs it to resolve obstacles. I used the Player position for that, since what we want is for the camera to move towards the player when there is an obstacle.

6608500--751933--upload_2020-12-10_10-10-52.png

Then I added the CMCollider extension with appropriate settings:

6608500--751936--upload_2020-12-10_10-12-11.png

It’s jittering a bit when I rotate the camera while a collision is being resolved, but other than that it’s ok. Are you seeing other issues with it?

Thank you for trying it. I also tried that but if you look above the character or to a wall, in my case the camera falls down below the floor or goes beyond the wall.

Here’s it clearer what is happening. If I aim at a collider far from the the player, camera will go behind that instead

Here’s what I’m trying to achieve, damping on Camera Collission. Though using CinemachineCollider with 3rdPersonFollow it tries to collide with everything on camera

That’s not what I’m getting. What version of CM are you using?

EDIT: I know what the problem is. There was a recent bugfix in ThirdPersonFollow that affects this. I’m testing with the fix, which explains why I’m getting better results than you are. If you like, you can embed your copy of CM and try a patch. It’s a one-liner. Let me know if you want to try it.

Embed means editing the CM script? I’d like to try please. Thank you so much.

I’m using 2.6.3. Should I update to 2.7.1 also?

Yes you should update to 2.7.1.

To embed a package, copy it from the package cache to your project’s Packages directory. If you just edit the code in the package without doing this, the edits will get magically undone because packages in the cache are supposed to be read-only.

Find the package in the cache by choosing “Edit Script” from unity on a CM behaviour, and seeing where that takes you. Close Unity, copy the entire com.unity.cinemachine folder to your project’s Packages, then re-open the project. When you edit the script again, it should take you to your new folder under Packages.

Then, find Cinemachine3rdPersonFollow.cs and comment out line 166 which reads curState.ReferenceLookAt = camPos + 1000.0f * (FollowTargetRotation * Vector3.forward);

That should do it. This change will be included in CM 2.7.2 when it ships, and at that time you can discard your local copy.

The result isn’t perfect (still a little jittery when you move the mouse while the collider is doing something) but it doesn’t go nuts. I will look into the jittery thing and try to figure out why that’s happening.

All this said, it probably would be a good idea to add damping to 3rdPersonFollow collision handling. We will take note of this. Thanks for bringing it up.

Thank you very much! It worked!

Thanks a lot. I’ll also be waiting for the official update and the jittery fix (but for me, this is better than before on what I’m working on instead of snapping directly behind the player when on collission).

Cheers!

1 Like

Hello. A new question rises. How can I change the WorldUp of the LookAt? I have changing gravity orientation depending on the planets.

Another way I’m thinking to fix this is to disable CinemachineCollider and remove LookAt object then edit the Cinemachine3rdPersonFollow instead to add damping, but I’m not sure the proper way to do it.

Oh I found your solution from the other thread! It’s fixed!