How to only collide with overlapping areas

Godot Version



I’m trying to make it so that the character only collides with the sections of a staticbody that are overlapping with another area2D, and I can’t figure out anything reliable. Functionally only the surface needs to be solid, as the other side won’t be approached. (Apologies for the low-quality example drawing)

1 Like

I don’t think such thing is possible. Once an area entered another area, or when a CollisionShape detects a collision, it will report. Why do you want a character to collide only once is inside an area?

I don’t think there is a built in way to do this, but I think it’s possible with some code.

The way I would to this is to rely on RayCasts to check the collisions my self.

These will be my setup,

  • 4 raycasts on the top, right, down and left of the player
  • Discard using physics layers to check collisions so I can manually track and react to collisions.


  • First check of any of the raycasts are detecting the Area2D
  • If the raycast is detecting area, shoot a ray to check for the static body. If it detects the static body, then stop the player moving in that direction.

In summary, if your raycast is detecting both area and staic body then that direction is a no go.

Of course, in practice, it will be more difficult to code than this, but this would be my setup.

Also, if you don’t want to face the issue of managing multiple detections with raycasts, you can use rayshapes to detect multiple collisions.

1 Like

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