phaser icon indicating copy to clipboard operation
phaser copied to clipboard

Pushable `false` bodies still move when circle shaped

Open kainage opened this issue 3 years ago • 2 comments

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)
    }
}

kainage avatar Mar 24 '21 03:03 kainage

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

dartinger avatar Feb 25 '22 22:02 dartinger

I am also struggling with this issue.

pixel-fabian avatar Feb 28 '22 20:02 pixel-fabian