Cube Explosion

This cube explosion is achieved by implementing a simple vector struct that requires a x, y, z coordinates and a variable for direction. Each particle in the cube explosion has randomized x, y, z constants which determine the direction in which the particle will travel in a straight line.


typedef struct Vector {

float x;
float y;
float z;
int direction;

} Vector;

typedef struct Particle {

Vector vPosition; // Position in space

} Particle;

10,000 particles were used for the explosion and all particles originate at the center of the cube. Particles move at a constant velocity and gradually fade into the darkness over time.