2

I am making a 3d particle system and I wonder how to make an explosion. My function will specify the number of particles that will create explosion effect. It will look like a growing sphere. My question is: how to calculate velocity Vector3 for every particle?

tshepang
  • 12,111
  • 21
  • 91
  • 136

2 Answers2

2

If you'd like to ensure that you don't have any clumping or biases, you're going to need to generate a uniform spherical distribution of points (which, as the link shows, is intuitive but somewhat non-trivial).

To create the animation in question, imagine a sphere of radius = 1 centered at the origin. If you then select a uniform spherical distribution of points, you can set your vector = point - origin. If you then translate that vector to originate at your point of explosion, you have a uniform distribution of vectors pointing out from the detonation.

Now, multiply those vectors by time * explosion speed and you have most of your animation. Keep in mind, a video game is going to call for a slower speed than real life. Watch some Mybusters videos for examples of supersonic shockwaves - neat on television but not as fun in a fame.

Bob Cross
  • 22,116
  • 12
  • 58
  • 95
  • @BrianVandenberg - you can have the next one. Uniform distribution type questions seem to come up a lot! – Bob Cross Sep 20 '13 at 17:04
0

The direction should be completely random, while the speed will have to be tuned by hand. Just keep adjusting it until you get a result that looks good, there is no correct answer.

fintelia
  • 1,201
  • 6
  • 17