How to add ParticleSystem in point where CollisionTrigger2D touch another?

How to add ParticleSystem in point where CollisionTrigger touch another?

i have a 2dCollision Trigger and when touch another collision need to create a particle system in the point where its touching.

how do that?

You could use "Instantiate" to create an instance of the particle system at this point. If your particle system is a custom one then make it into a "Prefab" so that you can then Instantiate it via scripting.

–

1 Answer

1

Create a prefab for your particle effect.
Create the effect, and assign it to the prefab. save it somewhere handy like…
/Prefabs/VFX

when you get your collision trigger, there is usually a variable called .point
you can use that point to instantiate your particle effect at that point.

public vfx myParticleEffect; // drag your partice effect prefab onto this public variable…
Then in your collision callback routine… jsut do this… easy :slight_smile:

GameObject fx = (GameObject) instantiate(myParticleEffect, collision.point, Quaturnion.identity);

or something prett close to that… should work great.

that work fine when its two colliders, but wen its triger only admits the other collider not a collision parameter. Or i am wrong?

–