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?
2 Answers
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.

- 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
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.

- 1,201
- 6
- 17