I'm diving into the tests world in godot and everything is so far so good. But I have a question.
When I need to test somethings that uses physics I usually do the following steps:
1. Setup tests
2. Wait for simulation
3. Check results
# This is just a method to create a cube and add collisions based on the masks and layers
var wall = TestUtils.create_static_body_cube(Vector3(0, 0, -1.5), , )
# This is just a method to add child and free it on the end of the test
# This is what is confusing me
var bodies := main_player.get_interaction_area_bodies() # calls area.get_overlapping_bodies()
My questions is just on the "wait for simulation" step, because I didn't understood well how godot handle physics simulation. I know it have a PhysicsServer and every X ms it runs the physics step, before the broad phase and narrow phase and so on. But, if that was the case, just waiting for the next "physics_frame" should be enough to handle all collision detection, since I'm not moving anything, just placing them and checking of overlaps.
The problem is, some times I need to chain the yield 2, 3 or even 5 times in order to the simulation actually happens. The above example won't work, I need to change the waiting step to:
Anyone knows why I have to wait for 3 or more physics frames in order to a single overlapping bodies simulation happens?