How to generate Particles when two objects collide?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GalacTicTac

So, I want to be able to create a particle effect when the player’s sword hits terrain or even another sword. I’ve already created a particle effect using the Particles2D node but i don’t get how to generate these particles at the point of collision. (Also, I’ve made the sword an Area2D node). Anyone know how to do this?

I tried similar thing not long ago and discovered that Areas are pretty much useless for detecting percise point of collision. Can You use any Body instead ? Bodies have detailed info about collision and You can get point of two bodies collision

Inces | 2022-01-04 19:39

Ok, If I change it to a kinematicbody2d or a rigidbody2d, how can I detect points of collision?

GalacTicTac | 2022-01-04 22:57

You need to iterate trough get_contact_count and get_contact_local_position within PhysicsDirectBodyState argument of integrate_forces()

Inces | 2022-01-05 14:45