I am making a game in 2D where you need to avoid hitting shrapnel. I want the shrapnel to be able to bounce of walls and floor but get destroyed when hitting other objects. I got the explosion and shrapnel ready, now i just have to destroy it when hitting the player for example. What do you think is this possible?
This is possible depending on the particle system type you use.
Using VFX graph you can input certain “areas” (Sphere, AABox) which can kill particles when they come into contact with them. They could then even have a custom death particle system spawning (yes, VFX graph is super cool). However, this approach is not really suitable for complex level geometry, since you probably do not want to feed hundreds of AABoxes into the system for performance reasons.
However if there are only a few triggers that should kill particles, this is a suitable solution. Its even easier to kill particles once they hit a certain plane for instance - you could check their y position and kill them when they are at or below 0 for instance.
In case you use the legacy unity particle system, there is an answer i found with a 10 second google search here:
Enable “Collision” module in particle system and set “life loss” to 1, change the layers in “collide with” and your object to destroy the particle so the particle only collides with collider of specific layer.
Hello.
I’m not an expert with pàrticle system, but as far as i know, you can not destroy one particle. All particle sistem is a component of an object, so…
Maybe, what you can do is to have multiple objects, each object with particle system component, and eachone only spawns 1 or 2 particles. So, you can destroy that object and not the others…
But maybe there is an other solution, i dont know, maybe there is something to add rigidbodies to the particles, aso they can be detected , or something…
Bye!