20-07-2022, 03:06 PM
(This post was last modified: 20-07-2022, 03:06 PM by CumaliSAH1N.)
(20-07-2022, 03:00 PM)josemendez Wrote: How are you killing those particles? could you share the code you're using?
Yes they do, like in any particle system. The only way to stop dead particles from re-emitting is to set the emitter's "min pool size" to 1, that way particles will begin respawning only once all have been killed. Maybe this is what you already have?
This is the code I'm using to kill the particles (some of the code is omitted for clarity).
All of my emitter's minpoolsize is set to 1
Code:
int filter = ObiUtils.MakeFilter(ObiUtils.CollideWithEverything, 0);
Vector3 position = hitPointTransform.position;
QueryShape query = new QueryShape(QueryShape.QueryType.Sphere, Vector3.zero, Vector3.zero, 0,
fluidCastRadius, filter);
AffineTransform affineTransform = new AffineTransform(position, Quaternion.identity, Vector4.one);
QueryResult[] results = obiSolver.SpatialQuery(query, affineTransform);
int length = results.Length;
for (int i = 0; i < length; i++)
{
int particleIndex = obiSolver.simplices[results[i].simplexIndex];
ObiSolver.ParticleInActor actor = obiSolver.particleToActor[particleIndex];
ObiEmitter emitter = actor.actor as ObiEmitter;
emitter.life[actor.indexInActor] = 0.0f;
}