I am using cinemachine in one of my projects, and I keep running in the issue that the camera jumps to center on the player from time to time, and I have no idea why.
This person seems to have the same issue, but no answer was posted:
Here are my camera settings:
I tried to add a cinemachine collider and tell it to avoid nothing, but it didn’t fix the issue.
The jump can be seen here
Any idea how this could be fixed?
Okay, I think I found the bug: whenever my object to follow was hitting the lower dead zone, the camera was re-centering on x. Is this intended behavior? seems like a bug to me.
Anyway, after some trial and error I found a solution: set soft zone to unlimited and play with the damping: set it to 0 for y to simulate a hard bound, and to a low value for x such that it re-centers nicely. Seems to be working, but also seems like a hack. The hard bound should be working too.
I stumbled across this question (and the reddit question mentioned by the OP) and tried the Best Answer which unfortunately didn’t work in my case.
Like the OP, I had a single VirtualCamera, no custom code, and the polygon collider was a square shape. Yet every time my character crossed the halfway point going up or down, the camera jumped in an awful way.
I fiddled with every possible field on the CinemachineVirtualCamera, the Confiner, the Camera itself, to know avail.
SOLUTION THAT WORKED FOR ME: My polygon collider, while square-ish, was not perfectly square. I ended up copying and pasting the point values of each X and Y of the corners to ensure the polygon was perfectly square. My values were off by an order of ~0.01 units (compared to the length of the squares of ~10 units).
I guess having a slightly obtuse or slightly acute angle (we’re talking 89.9 or 90.1 degrees) is enough to confuse the CinemachineVirtualCamera.