Sign in to follow this  

BUG: GO pointerdown not hit when camera scrollXY is changed and resolution is not 1

Recommended Posts

"phaser": "3.12.0-beta2",

Reproduce at


So when I change the scrollXY of the camera, and I try to click on a ImageGameObject it doesn't trigger the even pointerdown. If I randomly click in other places sometimes I hit the ImageGameObject, this makes me think there is a kind of offset problem in the calculation of the GO hit.


// Game

const config = {
  width: bbox.width,
  height: bbox.height,
  type: Phaser.AUTO,
  canvas: this.canvas,
  backgroundColor: '#091326',
  resolution: window.devicePixelRatio,
  render: {
    antialias: true,
    autoResize: true,
  scene: {
    preload: this.preload,
    create: this.create,
    update: this.update,
}; = new Phaser.Game(config);

// In create

this.hammer.on('pinchmove', (event) => {
  mainCamera.zoom = (mainCamera.zoom * 0.9 + mainCamera.zoom * event.scale * 0.1);
this.hammer.on('panmove', (event) => {
  this.pan = {x: event.deltaX, y: event.deltaY};
this.hammer.on('panend', (event) => {
  this.pan = undefined;
  this.previousPan = undefined;

// GO creation

planetsGO[] = {
  planet: scene.add.image(planet.x, planet.y, textureId),
  healthBar: new HealthBar(scene, planet),
planetsGO[].planet.displayWidth = planet.radius * 2;
planetsGO[].planet.displayHeight = planet.radius * 2;
planetsGO[].planet.on('pointerdown', () => {

// In update loop

if (this.pan) {
  if (this.previousPan) {
    mainCamera.scrollX += (this.previousPan.x - this.pan.x) / mainCamera.zoom;
    mainCamera.scrollY += (this.previousPan.y - this.pan.y) / mainCamera.zoom;
  this.previousPan = {...this.pan};


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.