Hey folks, I’m working on a tiny canvas pixel-art scroller and I’m trying to keep movement smooth on a 120hz monitor, but my sprites “buzz” by 1px when the camera follows the player (looks like subpixel rounding fighting itself).
const scale = 4;
let camX = 0;
function draw(dt, playerX) {
camX += (playerX - camX) * 0.12; // smooth follow
const sx = Math.round(camX) * scale;
ctx.setTransform(scale, 0, 0, scale, -sx, 0);
ctx.imageSmoothingEnabled = false;
// draw tilemap + sprite in world coords...
}
Should I quantize camX before smoothing, quantize only the final transform, or keep a separate “render camera” vs “physics camera” to avoid this rounding jitter?
Sora