Search Unity

Camera Judder

Discussion in 'Physics' started by CandJ, Jun 20, 2019.

  1. CandJ

    CandJ

    Joined:
    Oct 24, 2014
    Posts:
    4
    So I finished my movement scripts and found that the camera judders every half second or so. The object it follows moves smoothly when the camera is still, but when the camera follows it, the movement judders badly. I tried the tanks demo to see if that has the same issue and it does - when the camera in the game moves at a constant speed it appears to be being pulled along and judders the same. I have changed the Time settings to no avail.

    On the player
    Code (CSharp):
    1. void FixedUpdate()
    2.     {
    3.         rb.MovePosition(transform.position += new Vector3(x * Time.deltaTime * velocity, 0f, z * Time.deltaTime * velocity));
    4.     }
    On the camera

    Code (CSharp):
    1. void FixedUpdate()
    2.     {
    3.         transform.position = new Vector3(player.position.x, player.position.y + height, player.position.z - height/3);
    4.     }
    Have tried varying combinations of Update and FixedUpdate but always get this appearance of low fps even though the editor is registering 80 or so.