30-01-2018, 02:05 PM
(This post was last modified: 30-01-2018, 02:06 PM by tooomg.
Edit Reason: typos
)
(30-01-2018, 01:24 PM)UTFLuke Wrote: Yeah that what i am thinking too.
The logic I try to achieve is quite simple. I shoot obi particles in one direction. On the wall, where the Obi particles hit, i spawn some "Splat" Particles (standard unity particlesystem). But Obi fluid Particles are floating on the walls, thats why I only want to take the first Collision with the wall. Since the particle shooting works like a "water gun", you can shoot any amount of Particles you would like.
My problem is, that my splats particles are not spawning any more the after the 1414th Obi particle, since the obi particles are already in my hashset.
The reuse of the obi particles makes totally sence to me, performance wise. But I am really stuck with how I could spawn my splats at the first (and only the first) Collision with the wall.
Greets
Mmmh and why not deleting the particles as they splat on the wall? Are they supposed to be sticking on the wall? (like the sticking honey demo?). Maybe you could replace them with something more static at the collision location, so it doesn't need all the physic simulation Obi provides?
But if you do need to keep the particles around for the full duration of their lifespan, the more general issue is that you need to find a way to know when a particle has expired. A basic approach could be to check the lifespan of each particle in your HashSet on each frame, and clear the ones that are dead. You can do this by checking if emitter.life[particleIndex] is negative.
Hope this helps!
Cheers