+1 vote

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!

in Engine by (53 points)

1 Answer

+1 vote
Best answer

https://docs.godotengine.org/en/latest/classes/class_area.html#signals
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.

by (206 points)
selected by

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!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.