Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Particle Bounds Bug?


Recommended Posts



Just starting out with Phaser so there may be a simple fix to this: 


I have a small texture (9x12) that is being used for particles. The bounding box seems to not scale with the particle and is stuck at the original size, making collision detection problematic. I've attached an image of the issue. The particle is in the top left and the BB in green. 


Has anyone else had this problem?




Link to comment
Share on other sites

  • 2 weeks later...

I modified the particle scale example from the Examples suite to add in the debug body. I changed the emitter quantity to 20, which means it has to recycle old particles and reset the physics body dimensions, and it works as I'd expect. Full code is below (if you have the examples repo you can just run this from it to see)

var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });var emitter;function preload() {    game.load.image('sky', 'assets/skies/sky4.png');    game.load.spritesheet('veggies', 'assets/sprites/fruitnveg32wh37.png', 32, 32);}function create() {    game.add.image(0, 0, 'sky');    emitter = game.add.emitter(game.world.centerX, game.world.centerY, 20);    emitter.makeParticles('veggies', [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20], 20, true, true);    emitter.minParticleSpeed.setTo(-200, -300);    emitter.maxParticleSpeed.setTo(200, -400);    emitter.minParticleScale = 0.5;    emitter.maxParticleScale = 2;    emitter.gravity = 150;    emitter.bounce.setTo(0.5, 0.5);    emitter.angularDrag = 30;    // emitter.start(false, 8000, 400);    emitter.start(false, 6000, 100);}function update() {    game.physics.arcade.collide(emitter);}function render() {    for (var i = 0; i < emitter.total; i++)    {        if (emitter.children[i].visible)        {            game.debug.body(emitter.children[i]);        }    }}

Here is what I see:



Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...