is there a way to make an object suck up particles within a certain range? i have a black hole i made and using a wind zone it can suck up particles within a certain range but the problem is they just pass through the black hole to the other side of the wind zone. how can i make it so once they reach the black hole they either dissipate or get sucked into it until they dissipate themselves
Ooo, that sounds pretty cool. I haven’t fully explored Unity’s particle system, however, unless I am mistaken, this is sounding like a task for some code. Here is a quick script showing the idea of how to grab particles from a ParticleSystem component and modify them to put custom behaviors on them:
[SerializeField] private Transform blackHole;
private ParticleSystem ps;
private ParticleSystem.Particle[] modifiedParticles;
void Start() {
ps = GetComponent<ParticleSystem>();
modifiedParticles= new ParticleSystem.Particle[1000];
}
void Update() {
if (!ps)
return;
Vector3 vecToTarget = blackHole.position - transform.position;
float mag = vecToTarget.magnitude;
// Gets current particles from ParticleSystem and puts them into our particles array
int length = ps.GetParticles(modifiedParticles);
for (var i = 0; i < length; i++) {
// Modify the properties of the particles in modifiedParticles
// ...
modifiedParticles*.velocity += vecToTarget;*
}
// Put the modified particles back in the ParticleSystem
ps.SetParticles(modifiedParticles, length);
}
So, with this idea, you can apply a velocity to your particles towards the black hole to hopefully give the desired effect. I haven’t tested this exact code, but I pulled parts of some of my old code that worked, so hopefully it is at least pretty close to working.
Maybe this? Black Hole | VFX Particles | Unity Asset Store
It seems there was some particle system on the Asset Store that did this, not sure what it was called.
I’ve achieved this effect in the past by adding a collider to the center of the Wind Zone. Then enable collision in your particle system and set Dampen to 1, Bounce to 0, and Lifetime Loss to 1. This way as soon as a particle collides with the Wind Zone, it stops it in its tracks and kills it off. I also have a specific Wind Zone layer that I use just for that and tell the particle system to only collide with that layer.
No code required!