Stonekeeper Posted April 8, 2014 Share Posted April 8, 2014 Hi, 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? Thanks. Link to comment Share on other sites More sharing options...
rich Posted April 9, 2014 Share Posted April 9, 2014 I spotted this earlier today but thank you for posting. Basically the physics body wasn't being updated if the sprite scale changed. This is fixed in the dev branch (https://github.com/photonstorm/phaser/commit/e764be430e7a41427656e12f391a72cd05ec5521) which will be part of the 2.0.3 release later this week. Stonekeeper 1 Link to comment Share on other sites More sharing options...
Stonekeeper Posted April 10, 2014 Author Share Posted April 10, 2014 Thanks Rich. I found there were actually 2 bugs here and that 2.0.2 fixed one of them: bounds were being moved to the anchor point. Scaled bounds will rock even more! :-) Link to comment Share on other sites More sharing options...
hellbinder Posted April 22, 2014 Share Posted April 22, 2014 Hi, I'm using Phaser.2.03 and scaling emitters to half of the original sprite and when the particles collide, the bounds doesn't seem to change and seem as if they are floating when they hit the ground.. Am I missing something? Link to comment Share on other sites More sharing options...
rich Posted April 22, 2014 Share Posted April 22, 2014 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 More sharing options...
hellbinder Posted April 23, 2014 Share Posted April 23, 2014 Thank you for your efforts! I was able to fix my issue. Link to comment Share on other sites More sharing options...
Recommended Posts