Jump to content

How to control particle speed without affecting direction?


beeglebug
 Share

Recommended Posts

Is there any way using the publicly exposed method on an emitter to control the speed of particles without affecting the direction they are emitted from?

 

I am trying to create slowly falling particles, but when I change the minParticleSpeed and maxParticleSpeed properties all I get is particles coming out in a small cone.

Link to comment
Share on other sites

Did you decrease the gravity value of the emitter by the same amount? When you decrease the particle speed, but leave the gravity unchanged, of course they will fall in a different shape.

Imagine it like throwing a ball with very small force. It won't follow the same trajectory, only slower. It will fall down right before your feet. But if you were able to decrease the earth's gravity, the ball would fly the exact same path as a harder thrown ball with more gravity. 

 

Hope thats understandable :)

Link to comment
Share on other sites

Ok, i've had a detailed play with the particles for a while now, and I understand it much better now.

 

My earlier confusion comes from the fact there is a single pair of properties, minParticleSpeed, and maxParticleSpeed, which actually control two things, the initial direction of the particles, and their speed.

 

Tecnically, these properties should probably be called "velocity" not speed (velocity being a direction plus a speed), and to give more flexibility perhaps speed could be moved out into it's own property?

 

Perhaps this is a candidate for a plugin? Phaser Advanced Particles anyone?

Link to comment
Share on other sites

  • 1 year later...

Hi, I was on a same issue and it took me time to find how to use minParticleSpeed and maxParticleSpeed.

The documentation say:

minParticleSpeed : Phaser.Point The minimum possible velocity of a particle.

Which is not very helpful at all, because there is no clue how to use it or set it and what kind of parameters it needs.

There is nothing in the examples as well.

Anyway I found this tutorial which open my eyes for those.

//make the player explodevar emitter = this.game.add.emitter(this.player.x, this.player.y, 100);emitter.makeParticles('playerParticle');emitter.minParticleSpeed.setTo(-200, -200);emitter.maxParticleSpeed.setTo(200, 200);emitter.gravity = 0;emitter.start(true, 1000, null, 100);this.player.kill();
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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