Fixing collision between physics body/mouse, acceleration

Something like

const { fps } = this.physics.world;

this.squares.children.iterate(child => {
    const dx = (child.baseXY[0] - child.x) / child.x * this.acceleration;
    const dy = (child.baseXY[1] - child.y) / child.y * this.acceleration;

    child.body.velocity.set(fps * dx, fps * dy);
});
1 Like