How to actively check for collisions with Area2D?

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

I’m trying to register body collisions with Area2D nodes, with “body_entered” signal, but the Area2D never registers any collision.

It only registers collisions when it’s first loaded in the scene, and whenever i drag or modify the game window with my mouse.

I don’t have any _process or _physics_process functions, only signals “body_entered” connected to the area itself. Anyone know how to solve this?

If you haven’t found a solution yet, could you update your post with your code?

The “body_entered” signal is only triggered when a body enters the area. It won’t continuously send a signal after that if the body stays in the area. In order to continuously check for bodies, try using get_overlapping_bodies() in your _process function.

func _process(delta):
    for body in $Area2D.get_overlapping_bodies():
        [...]

Also double check your collision layers just in case.

Bernard Cloutier | 2020-01-23 14:45