Particle Systems

Particles can be affected by forces. This can be implemented in the same way as applying forces to ordinary solid objects.

    dms::Vector3 gravityAccel = gravity_ * dt;
    dms::Vector3 windAccel = wind_ * dt;
    for (int i=0; i < numParticles_; i++)
        {
        particles_[i].velocity += gravityAccel;
        particles_[i].velocity += windAccel;
        particles_[i].tailPosition = particles_[i].position;
        particles_[i].position += particles_[i].velocity * dt;
        }




Examples:





next