I've seen this question:

How to smoothly move camera when the player is climbing a diagonal staircase in 2D tile-based side-scroller?

And here's my code:

export default class Camera {

  target: Point;
  frustum: Rect;

  update() {
    this.frustum.x += (this.target.x - this.frustum.x) * 0.1;
    this.frustum.y += (this.target.y - this.frustum.y) * 0.1;

// usage

export class User {

  camera: Camera

  update() {
    if (this.camera.target.distanceBetween(this.player.position) > 8 * TileSize) {
      this.camera.target = this.player.position;

  render() {


So basically, camera has a frustum that smoothly approaches to target position. If the player position is greater than some distance, the camera target position is set to player position.

This results in something like this:

camera jitter

As you can see camera stops for a second, then follows then stops again, if I decrease the distance threshold to follow the camera, the jitter happens on the player.

Why is this happening to me, just why?


You must log in to answer this question.

Browse other questions tagged .