• Advertisement

Archived

This topic is now archived and is closed to further replies.

particles

This topic is 5997 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So far with every particle effect I''ve made there has always been a spurt of particles at the very front before the actual bunch of particles start coming out. What can I do to make that stop? I have no idea what I''m doing wrong. Here is an example of what I''m doing to make snow if it helps:
  
// this is in main loop

for (int index = 0; index < MAX_PARTICLES; index++)
{
	glColor4f(1.0f, 1.0f, 1.0f, snow[index].life);

	glBegin(GL_POINTS);
		glVertex3f(snow[index].x, snow[index].y, snow[index].z);
	glEnd();

	snow[index].life -= snow[index].fade;
	snow[index].y -= snow[index].ys;

	if (snow[index].life <= 0.0f)
	{
		snow[index].life = 1.0f;
		snow[index].fade = random(0.001f, 0.003f);
		snow[index].x = random(-4.0f, 4.0f);
		snow[index].y = 3.2f;
		snow[index].z = random(-1.5f, -3.5f);
		snow[index].ys = random(0.009f, 0.012);
	}
}
  
Thanks.

Share this post


Link to post
Share on other sites
Advertisement
The problem is that when your algorithm starts, you create MAX_PARTICLES and shoot them off. One thing you might do, is add a delay field to your particle struct, and initialize it with a random value when you initially create your particles. On your display/animation loop, skip the particles with a positive delay, only decrementing it. Once the delay reaches zero, do a reset of the particle and fire it off.

Share this post


Link to post
Share on other sites

  • Advertisement