So I'm trying to have particles disappear when they collide with an object. I have tried three methods but all seem to cause the emitter to behave weird. When the particles collide with the object they do disappear but it seems like at a certain point (30 seconds in), particles just disappear as soon they emitted when I use either one of these methods.
Is there a standard way for removing specific particles when a collision takes place?
Code:
private void Solver_OnCollision(ObiSolver s, ObiSolver.ObiCollisionEventArgs e)
{
var world = ObiColliderWorld.GetInstance();
foreach (Oni.Contact contact in e.contacts)
{
// look for actual contacts only:
if (contact.distance < 0.01f)
{
var col = world.colliderHandles[contact.other].owner;
if (col.tag == "Outlet")
{
Debug.Log("Remove Particle");
if(method1)
emitter.solver.actors[0].DeactivateParticle(contact.particle);
else if(method2)
emitter.life[contact.particle] = 0;
else if(method3)
emitter.KillParticle(contact.particle);
}
}
}
}
Is there a standard way for removing specific particles when a collision takes place?