Mass and Collision Momentum

Demonstrates how setting a body's mass property affects the momentum and rebound behavior when two Arcade Physics bodies collide.

Mass and Collision Momentum, running
800 × 600
GitHub
class Example extends Phaser.Scene
{
    preload ()
    {
        this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
        this.load.image('block', 'assets/sprites/block.png');
        this.load.image('ball', 'assets/sprites/shinyball.png');
    }

    create ()
    {
        const block = this.physics.add.image(200, 300, 'block');

        block.setBounce(1);

        const ball = this.physics.add.image(0, 300, 'ball');

        ball.setBounce(1);
        ball.setMass(10);
        ball.setVelocityX(100);

        this.physics.add.collider(ball, block);
    }
}

const config = {
    scale: { mode: Phaser.Scale.FIT },
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    parent: 'game-container',
    physics: {
        default: 'arcade',
        arcade: { debug: false }
    },
    scene: Example
};

const game = new Phaser.Game(config);

More in Arcade132 examples