This surely has been asked before but can’t seem to find it. If I have a particle system and a gameobject with a rigidbody 2d kinematic on it and a polygon collider 2D with “is Trigger” checked the following code does not react:
If I uncheck the “is Trigger” Box everything works as collision is detected and I suspect it is because particle system act as 2d physics and when the go through the collider (“is Trigger”) there is no reaction7feedback.
My question is : Can a gameobject with a rigidbody 2d kinematic and a polygon collider2d detect a particle collision with a function in a script (like the one above) and if yes what is the correct function (if not OnParticleCollision)?
Being Kinematic (how it moves) and a specific collider isn’t relevant to the question and note that the 2D physics system doesn’t know anything about particles. The particle system performs Circle queries just like you would, it’s a user of the physics system as you are.
It either performs CircleCast queries when you want collisions or it performs OverlapCircle queries when you want overlaps (triggers). AFAIK it has a CollisionModule for collisions and a TriggerModule for triggers.
This is well documented in the Particle System manual. Did you read the docs or look at any online tutorials (there are lots)?
Thank you for your reply and insight. I understood some fundamentals about the Particle system which indeed I didn’t research before asking my question.
What I wanted was a script / function how to detect collision event though the Particle System goes through the collider which “Is Trigger”.
The solution I found is, as gratefully suggested by MelvMay, is in the well documented Particle System Manual:
You need to start from the particle system (PS) instead from the gameObject
on the PS you need to uncheck Collsion module and active Triggers module
you want use the action option “Callback” for the trigger condition (like Enter, Exit, etc.)
the script is on the PS and the function needed is void OnParticleTrigger() where you can specify what happens to the particles