I have been looking all over the internet for an answer. However, none of them seems to be a solution for me.
I am trying to get particle collision on an enemy for this game I am working one. The particle system acts like cold mist and when the enemy runs into the particles, they are to slow down. However, onParticleCollision() isn’t even being activated.
Your collider has “IsTrigger” enabled. Triggers don’t generate collisions, by definition: their only purpose is to trigger actions when objects go inside them.
Either use OnParticleTrigger if you want to use triggers, or uncheck “IsTrigger” otherwise.
That was temporarily until I figured out how to rotate it as I need it facing a specific direction.
It works now. thx. Although I swear I tried that before with same results. However, with the World 3D set, it doesn’t work with me. For some odd reason I can’t set the direction, which makes it out of control.
Hi, I’m actually also having trouble getting OnParticleCollision callback.
My physics world and particle system world mode is both 2D, my colliders aren’t marked as isTrigger. It also detects collisions - i.e, moves the particles accordingly when a collider touches them, but the actual OnParticleCollision isn’t called.
I’ve tried both when the script with the OnParticleCollision methoed sits on the game obejct that has a collider, and when it’s on the particle system. In no case do I get the code inside OnParticleCollision to execute (currently just a debug statement). Any help with this?
EDIT
Well I’ll be happy to help you, me.
In order for this to actually work, aside from what’s been said you need to also:
Mark “Send Collision Messages” as true (on the collision tab inside the particle system).
Make sure either your collider-object has a kinematic Rigidbody, or you particle system has “Allow dynamic collisions” set (I think that’s what its called). If it deosn’t work than it’s some other combos, but that’s the gist of it.
Oh and I got it to work when OnParticleCollision was on a script that sits on the colliding object, and not on the PS.
It would have been better to allow OnParticleTrigger that passed the collider as reference, so the triggered collider could execute code, without causing displacement in the particles, but oh well.
Hello, is it possible to use OnParticleCollision (with “Send Collision Messages” on) and still have the particles go through the object (object’s collider is trigger !) ?
I want particles to damage the player but not physically interact with it, they should just continue their movement.
Is this possible?
Adding to my previous post (just above) : Is there a third party 2D particle system asset ?
The particle system in Unity is 3D and some particles are behind the 2D objects.
I want my particles to be on the same Z (Or same layer order)
Edit: I found the Layer Order in the Rendering part of the Particle System, so that’s ok now.
But are there good alternatives for the Unity Particle system, like some 3rd party asset?