Skip to content

Arcade Physics: Immovable Object Moves when it has circular collision #7054

Closed

Description

@hunkydoryrepair

Version

  • Phaser Version: 3.88.0 - 3.88.2
  • Operating system: Mac OS and Windows
  • Browser: Chrome/all

Description

An immovable object with circular collision will move when an object with rectangular collision collides with it.
This is inconsistent with all earlier versions, and with rectangular objects.
In order to prevent an object from moving in 3.88.1, the body must be set to immovable, and have pushable explicitly set to false AND the object colliding with it must be pushable.

Example Test Code

in comments. the behavior is clear in the separateCircle function of world.js. When object is immovable but pushable, it moves it.

Additional Information

The behavior is USEFUL, but an unnecessary breaking change, and inconsistent with other shapes. setImmovable could set pushable to false, and require it be explicitly enabled, which should prevent it from being a breaking change.

Activity

  1. hunkydoryrepair commented on Feb 21, 2025

    @hunkydoryrepair
    Author

    https://jsfiddle.net/eb9ygph5/

    const GameScene = new Phaser.Scene();
    
    GameScene.init = function() {};
    
    GameScene.preload = function() {};
    
    GameScene.create = function() {
      const img = this.physics.add.sprite(150, 150, "newmachine");
      img.body.setCircle(50, 0, 0);
      img.body.setImmovable();
      const img2 = this.physics.add.sprite(450, 150, "newmachine");
      img2.body.setSize(50, 50);
      this.physics.add.collider(img2, img);
      img2.body.setVelocity(-20, 0);
      
      // END Collision Detector definitions
    };
    
    // UPDATE
    GameScene.update = function() {};
    
    const config = {
      type: Phaser.AUTO,
      width: 640,
      height: 480,
      physics: {
        default: 'arcade',
        arcade: {
          debug: true,
        }
      },
      scene: [GameScene]
    };
    
    const game = new Phaser.Game(config);
    
  2. hunkydoryrepair commented on Feb 21, 2025

    @hunkydoryrepair
    Author

    This fiddle shows the behavior did not happen as recently as 3.87.0
    https://jsfiddle.net/eb9ygph5/2/

  3. self-assigned this
    on Mar 20, 2025
  4. zekeatchan commented on Mar 20, 2025

    @zekeatchan
    Contributor

    Hi @hunkydoryrepair. Thanks for submitting this issue. We have fixed this and pushed it to the master branch. It will be part of the next release. Do test it out and let us know if you encounter any issues.

  5. added a commit that references this issue on Mar 20, 2025
    a5a56b2
  6. locked as resolved and limited conversation to collaborators on Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions