How to instantiate a (different) particle system on particle collision and at the collision location
I'm stuck with something that seems to be a pretty common problem. I'm trying to instantiate some FX when my collider gets hit by a particle. Now, that's not to bad yet, it could easily be done like this:
[SerializeField] GameObject hitFX; void OnParticleCollision() { GameObject runtimeHitFX = Instantiate(hitFX, transform.position, Quaternion.identity); }
However, this will spawn the FX at the position of (or at least dependent on) the game object being hit. Now I know there's such a thing as a Collision object, and even such a thing as its Intersection point in worldspace coordinates. I just don't get how to call it. In theory it should look something like this: [SerializeField] GameObject hitFX; void OnParticleCollision() { new Transform impactPoint; impactPoint = //somehow get the collisions impact/intersect location GameObject runtimeHitFX = Instantiate(hitFX, impactPoint.position, Quaternion.identity); }
I know there are a couple of older questions on this very topic still floating around. They are mostly for older version of Unity, using deprecated code or simply haven't gotten an answer/don't work. Unity's documentation on OnParticleCollision() is pretty vapid, yet it appears to behave differently than OnCollision().
Your answer
![](https://koobas.hobune.stream/wayback/20220612211653im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Disable collisions between particles 0 Answers
How to make a permeable mesh collider? 1 Answer
OnTriggerEnter with Particle Collider 1 Answer
Making particle effect script on collision 0 Answers
Little dust particles after player jump hitting ground 2 Answers