I am making a top down pixel art game and am using a simple follow script for my camera.

void Update()
        transform.position = new Vector3(target.transform.position.x, target.transform.position.y, transform.position.z);

However i get this weird stuttering effect while moving around: https://gfycat.com/tintedlightheartedcrayfish

Any way to smooth out the camera movement?

  • \$\begingroup\$ This doesn't look like stuttering to me — the movement is smooth, not stop-and-start. I'd describe this as a shimmering in your background sprites. This can occur if you're using Nearest Neighbour / Point filtering for crisp pixels, but you're displaying them at a screen size that's not quite an integer multiple of their source size. I have some past answers showing this in action, which may be of some help to you. \$\endgroup\$
    – DMGregory
    Oct 4, 2021 at 12:50
  • 1
    \$\begingroup\$ Why don't use cinemachine and get rid of all camera coding problems forever. \$\endgroup\$
    – Ivan
    Oct 4, 2021 at 13:13
  • \$\begingroup\$ @DMGregory I am using PixelPerfect Camera and have it set to 16 Pixels per Unit so its 1:1 to the tilesize. \$\endgroup\$
    – JP2K
    Oct 4, 2021 at 14:43
  • \$\begingroup\$ @Ivan I get artifact lines in between tiles when moving using Cinemachine, which I don't get when using Pixel Perfect. that's why I've chosen it. Tried to mess around with Cinemachine to get rid of those artifacts but to no avail. \$\endgroup\$
    – JP2K
    Oct 4, 2021 at 15:03
  • \$\begingroup\$ @DMGregory i sorta fixed it, since i was using Pixel Snapping setting in Pixel Perfect Camera that caused the shimmering, however it is still there when moving diagonally \$\endgroup\$
    – JP2K
    Oct 4, 2021 at 16:26


You must log in to answer this question.

Browse other questions tagged .