Hi, I’m having quite some problem with my camera. The collision is not working and ending up completely jittery, making the game unplayable. However, I do not use any other collision than the one from the cinemachine driven camera. I pinned the issue down to a line of code where the camera gets placed.

Would you have any suggestions how to do this in a better way? Or why this line of code is making the cinemachine camera jittery on collision? It’s like if it tries to be at 2 places at the same time. Constantly switching between them.

So in update I have;

center_point.position = playerMovement.transform.position;

And in fixedUpdate there is:

player_cam.position = Vector3.Lerp(player_cam.position, destination, Time.deltaTime * 10);
            destination = center_point.position + center_point.forward * -1 * cameraDistance + Vector3.up * height;
  • please let me know if you need any more infos. Like about the cinemachine camera setup or the full camera code (not much more in there besides mouse movement)

Any help would be highly appreciated. Thank you in advice

Going on a whim here since I don’t know much about the rest of the code or the desired behaviour of the code you posted, but it could be either of the following things:

  • destination is being set after the lerp is done.
  • You’re using FixedUpdate , which is on a fixed timestep to place the camera, instead of LateUpdate, which would result in smoother results.
  • You’re using Time.deltaTime instead of Time.fixedDeltaTime.

Changing to LateUpdate with the use of fixed timestep fixed all the issues. Thank you very much, Ziplaw! :slight_smile: