I'm writing a particle system for our student game, and I've run into a bit of a snag. I want to improve the effect on the ships' rockets, but I can't seem to figure out how.
Here's how the effect looks on a stationary ship:
And here's how it looks on a moving ship:
I want the flames to be the same length consistently. Here's Particle
's Tick
function:
void Particle::Tick(float a_DT)
{
// temporarily turned off to see the effect of the rest of the code more clearly
//m_Pos += m_Vel;
if (m_Owner) { m_Pos += m_Owner->GetParentSpeed(); }
m_Life -= 1;
if (m_Life <= 0) { m_Alive = false; }
}
Thanks in advance.
EDIT: To clear things up a bit, I want the effect to trail, but I want it to trail the same way regardless of the emitter's speed.
You're making the particles move faster or slower according to the parent ship's speed, but their lifetime is some constant that you decrement by one until you reach zero, correct?
What you probably want to do is set the lifetime to a distance value, rather than some number of ticks. Then, subtract the ship's speed (or whatever you're adding to each particle on each tick) from the lifetime. When lifetime goes negative, kill the particle.
I think that's what you want... but it might be cooler (and more realistic) if you make two changes to your algorithm:
The current behavior (length of the tail) is correct if the particle speed coming out of your engines is based upon thrust (acceleration rather than just speed).
Once a particle leaves the engine, any changes in speed/direction of the ship have no effect on it. Once the particle is emitted, it's speed and direction are constant until it fizzles out. This should actually look pretty cool when you're turning the ship, or dramatically changing acceleration.
Cheers.