Archived

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

Dr Pain

Killing a particle

Recommended Posts

Inside a collision callback for a particle, how do I actually kill the particle if I determine it''s collided? I tried setting the particle''s TimeCount and MaxTime to zero, but that didn''t do it. I searched all of the PR4 directory for an example of PR_SetParticleCollisionProc, but all I found was the prototype in prpart.h. Also, the particle''s LastLocation is not automatically updated, so I assume I have to update it in the collision callback routine. No big deal, just verifying. Thanks, Dave

Share this post


Link to post
Share on other sites
Either set of the variables like time or alpha to less than zero so it will be removed in the next update, or call the remove function directly:

PR_RemoveParticle (particle->Index);

The last location is updated for emitters but not particles.

Share this post


Link to post
Share on other sites
Ok, thanks, I''ll try that.

As for LastLocation, I also notice that the particle doesn''t have a pointer to the emitter that created it. Therefore, there''s no way to get the initial location of the particle, so collisions during the first frame will be missed (LastLocation is initialized to (0,0,0)).

Unless the collision routine is called before the particle is moved for the first time. I haven''t checked this, can you tell me if this is the case?

Share this post


Link to post
Share on other sites
I guess I could have my render callback set the LastLocation. Question is, does the particle start its life (first render) at the emitter''s location, or at the location defined by time T+1?

Share this post


Link to post
Share on other sites