Update Area's position and get overlapping bodies in same frame

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

I have an area in 3D space that I would like to be able to move in the _physics_process function and get any overlapping bodies. The speed is important because I don’t update the body every frame, only when an event happens that I need to use any overlapping bodies to process. I may be able to use yield(get_tree(), "physics_frame") to do it, but I would prefer to do it on the same “frame” if possible.

Thank you!

:bust_in_silhouette: Reply From: ATom 1

Check this signal section
Receive signals from objects in and out. When an object enters the area, add it to a group or array. When the object leaves, delete it from the group or array. This is the fastest way.

Hmm, that might be the best way to do it. I could connect the signals for a single physics update and then get the overlapping bodies and use them in the frame after. Thank you!

GammaGames | 2020-01-10 06:44