How can I detect the exact point where two Shapes collide?

Godot Version

4.2

Question

I’m working on a 2D Action RPG. My player character is hitting an enemy character’s hurtbox. I want to create a “hitmarker” effect, the kind that you’ll see in any kind of action game. To do this, I want to instantiate an animated sprite on the intersection ofthe players hitbox with the enemy’s hurtbox.

Is there an easy way to do this? Thanks in advance.

For an Area2D often shapes will have two or more points of intersection, and I’m not sure getting either is exposed. So it may be best to get a mid-point between the two areas.

PhysicsBodys have a number of ways though I doubt you want to use them in this case.

Raycasts are built to collide at one point so try these out if you need accuracy.

1 Like

Ended up going with a raycast approach, did exactly what I needed. Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.