I have two KinematicBody2D nodes with circle collision shapes. Body1 stays in one spot calling
_physics_process. Body2 is initially colliding with Body1 and then every
move_and_collide to move away from Body1.
If Body1 detects a collision it calls
get_tree().set_deferred("paused", true), waits one second, then unpauses. It then enters an infinite loop, detecting a collision on every physics step, even as you can see Body2 moving farther and farther from Body1.
If I comment out the line that pauses the scene tree, only 1 collision is detected and the scene works as expected.
Am I missing something or is this a bug? Any workaround?
Below is the code for Body1:
get_tree().paused = false
EDIT: Here's a link to the example project. Please enable Visible Collision Shapes in the Debug menu. If you run the project you'll see the infinite loop I'm talking about. If you comment out the line that paused the tree it runs perfectly.