How to create a sensor object that I can poll to tell if it's hitting something?

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

I’d like to add a sensor sphere to my 3D player object (which is modeled as a kinematic body). While I don’t want this sphere to be part of my player character’s collision shape, I do want to be able to check it during the _physics_process() call to see if it is hitting any walls or other objects. What’s the best way to do this?

My first attempt at this was to create an Area. I’ve tried monitoring the _on_body_entered() and _on_body_exited() signals, but there is a constant stream of objects entering and exiting my collision area. It would be better if I could simply ask during the _physics_process() call if there is anything intersecting with my sensor at that moment.

:bust_in_silhouette: Reply From: kitfox

Looks like Area.get_overlapping_bodies() was what I was looking for.