Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pushable false bodies still move when circle shaped #5617

Closed
kainage opened this issue Mar 24, 2021 · 3 comments · May be fixed by jonesrussell/nishman#6
Closed

Pushable false bodies still move when circle shaped #5617

kainage opened this issue Mar 24, 2021 · 3 comments · May be fixed by jonesrussell/nishman#6
Assignees

Comments

@kainage
Copy link
Contributor

kainage commented Mar 24, 2021

Version

  • Phaser Version: 3.53.1
  • Operating system: Mac, Linux

Description

Bodies are still pushable when both pushable values are set to false when either one of them is a circle.
Works fine only when both are rectangles.

Example Test Code

var config = {
    type: Phaser.AUTO,
    width: 864,
    height: 632,
    parent: 'phaser-example',
    backgroundColor: '#2d2d2d',
    physics: {
        default: 'arcade',
        arcade: {
            gravity: { y: 0 },
            debug: true
        }
    },
    scene: {
        preload: preload,
        create: create,
        update: update,
    }
};

var game = new Phaser.Game(config);

function preload ()
{
    this.load.setPath('assets/sprites');
    this.load.image('blockANP');
    this.load.image('blockBNP');
}

var cursors
var left

function create ()
{
    this.physics.world.setBounds(0, 0, 864, 632);

    cursors = this.input.keyboard.createCursorKeys();

    left = this.physics.add.image(200, 196-16, 'blockANP').setCollideWorldBounds().setInteractive();
    var right = this.physics.add.image(600, 196-16, 'blockBNP').setCollideWorldBounds().setInteractive();

    left.setBounce(0.5);
    right.setBounce(0.5);

    // If either one of these are a circle they will get pushed.
 
    left.setCircle(32)
    right.setCircle(32)

    left.setPushable(false);
    right.setPushable(false);

    this.physics.add.collider(left, right);
}

function update ()
{
    if (cursors.left.isDown)
    {
        left.setVelocityX(-160);
    }
    else if (cursors.right.isDown)
    {
        left.setVelocityX(160);
    }
    else if (cursors.up.isDown)
    {
        left.setVelocityY(-160);
    }
    else if (cursors.down.isDown)
    {
        left.setVelocityY(160);
    }
    else {
        left.setVelocity(0)
    }
}
@dartinger
Copy link

I can confirm the problem wasn't solved until version 3.55.2. (OS: Linux/Ubuntu)

@pixel-fabian
Copy link

I am also struggling with this issue.

@phaserjs phaserjs deleted a comment from SlimHajRomdhane Mar 26, 2023
@zekeatchan zekeatchan self-assigned this Jun 14, 2024
@zekeatchan
Copy link
Collaborator

This issue has been resolved.

Arcade body circles setPushable method updated to include collisions between two circles. Setting the Arcade Body setPushable(false) method for circle bodies prevents them from being pushed by other circle bodies.

This will be included in the next update. Thank you for bringing this to our attention!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants