How can i emit a particle at a collisions location?

I’m catching the gist of it so far.

I’m trying to use the contact point in the collision script but I don’t know how to use a particle emitter with it.

The effect I’m trying to achieve is a Comic punch effect, like when a comic character punches the bad guy and stuff.

Can someone please help me?

Something like:

GameObject particleSystemPrefab;

void OnCollisionEnter(Collision collision) {
    foreach (ContactPoint contact in collision.contacts) {
         //Instantiate your particle system here.
         Instantiate(particleSystemPrefab, contact.point, Quaternion.identity)
    }
}

This will instantiate a particle system at each contact point but if you want you can instantiate at certain points like only on first contact point or so by writing those conditions.

Since this still shows up early in google I thought I’d add this!

You should avoid instantiating objects as it’s very inefficient. You can get away with it as a one off here and there, but using it regularly (as well as destroying things) will kill your performance.

Use object pooling instead. You have a “pool” of the object in your scene, and just take them from the pool and enable/disable them instead. It’s easy and you can find a great explanation and tutorial on it at https://www.raywenderlich.com/136091/object-pooling-unity

Can Someone help me? I am using Unity 2019 version and particles are not emitting at certain position