 |
|
|
 |
A particle simulation must have a particle structure. In this simulation I created an external chunk of particles that required no constructor, since calling the constructor for thousands of
particles would be slow. All particles have a start position which is used when a particle needs ro be reborn. Tests were performed with initiating a random position everytime a
particle needed to be reborn but significantly slowed the sim. Instead I change the size when a particle is reborn to achieve the same visual effect of random birth and just use
the initial random distribution of particles created during world spawn. Also included is an emitter class that sets the various attributes for the paritcle chunk when either the world spawns or when a particle's state needs to be updated.
|
|
 |
The simulation loop was optimized to allow special computations for all emitters in the scene. Integration and forces are only computed for a live particle. Collission detection is only carried out if a
particle is not in the safe zone, which is computed to be the area in the the world that has no collission objects. Checking to see of a particle is in range of vortex influence which vortex to use, but
speeds up the sim as well. Making sure that we arent doing unnecesary computation is the key to making a particle sim run good.
|
|