I was creating a simple particle system for SDL for a 2D project. My generation features work fine, and I can create velocity, as well as location of the particle generation. What I need to do is indicate direction of movement, for example, like in a smoke trail for a rocket. So how do I make a particle system choose the direction of movement of the particles?
Share
In order to give each particle a direction of movement, take an absolute angle of choice (with 0 pointing to the right of the display), a modulus (for the speed of the particle) and perform these simple trigonometric instructions:
The actual instructions depend on the underlying data structures, but the mathematical concept is flawless. Just be careful with the angle and the functions you are using: both must be of the same angle units (degrees, radians,…).