Skip to content

Commit

Permalink
debug: add USE_INTERPOLATION flag to PixiEntity
Browse files Browse the repository at this point in the history
  • Loading branch information
char committed Feb 3, 2025
1 parent ab7b86e commit 95fc143
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions engine/entity/pixi-entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import * as internal from "@dreamlab/engine/internal";
import * as PIXI from "@dreamlab/vendor/pixi.ts";

export abstract class PixiEntity extends Entity {
static USE_INTERPOLATION = true;

public container: PIXI.Container | undefined;

static: boolean = false;
Expand All @@ -21,8 +23,10 @@ export abstract class PixiEntity extends Entity {
#updateContainerPosition() {
if (!this.container) return;

const pos = this.interpolated.position;
const rot = this.interpolated.rotation;
const transform = PixiEntity.USE_INTERPOLATION ? this.interpolated : this.globalTransform;
const pos = transform.position;
const rot = transform.rotation;

this.container.position.set(pos.x, -pos.y);
this.container.rotation = -rot;
this.container.zIndex = this.z;
Expand Down

0 comments on commit 95fc143

Please sign in to comment.