Fixing jittering while position smoothing is enabled for camera2d

Godot Version

4.2.1

Question

I wanna get positional smoothing for the camera but i can’t seem to get it working without the player character “jittering” on the screen. I found some tutorials but couldnt get them to work.

I know this is a vague question but if you have any experience or advice with this it would be appreciated :slight_smile:
Any and all help is welcome :slight_smile:

If anti-aliasing is disabled, it can look like the player jitters very slightly by one pixel. (Enable anti-aliasing in Project Settings > Rendering > Anti Aliasing; it might not be what you want for pixel-art games though)

Otherwise, using the built-in position smoothing I haven’t been able to reproduce any “jittering” behaviour. If what I described isn’t your problem, could you include a minimal working example of the issue?

Antialiasing unfortunately didn’t fix the issue

The issue isnt as clear on video imo

The reason jittering occures is because the camera moves in subpixels while everything else moves in pixelperfect increments. So whenever the player sprite moves it snaps into the pixel perfect “frame” while the camera moves in much smaller increments (subpixels)


(I made this for myself and this makes sense for me)
(I hope it makes sense to you aswell)

This issue dosent occur when position smoothing is disabled since the camera moves in the same increments as the player sprite

I don’t think there’s any way around this unless you’re willing to sacrifice either the smooth camera movement, or the “true” pixelation of the game by having the player move between pixels. If it’s moving in visible increments it will necessarily look like it’s jittering, right?

Sorry for late reply.
it sound logical what you are saying but after some experimentation i found that in the inspector you can set the camera process callback to physics or idle (this is the same as using the function physics_process(delta) or using _process(delta))

When setting process callback to physics the player stops jittering but the background jitters slightly and vice versa. when process is set to idle the player jitters but the background is clear