godot_debug_draw icon indicating copy to clipboard operation
godot_debug_draw copied to clipboard

Drawn objects don't disappear when created from `_physics_process`

Open geegaz opened this issue 2 years ago • 2 comments

Hello !

Always when using any of the draw_box, draw_line_3d and draw_ray_3d functions from _physics_process, the drawn objects don't disappear - they disappear as expected when the functions are called from _process. This causes the game to slow down and become unplayable after a few seconds, due to the huge amount of nodes created every second.

I'm using Godot 3.4.4, with the addons "heightmap terrain" and "trails"

Here's a video of the issue: https://user-images.githubusercontent.com/39198556/168067640-1a3bf8f0-33f0-4da4-9581-b0af3690dce5.mp4

I tried replacing Engine.get_frames_drawn() by Engine.get_idle_frames() in debug_draw.gd, but it didn't change anything. Do you have an idea of what could be causing it ?

geegaz avatar May 12 '22 11:05 geegaz

Do you have errors when this happens? Did you pause the game? Is debug_draw an autoload or did you add it as child of something in your scene? If there is no error I suspect it could be the way frames increment, causing drawn items to miss their lingering removal frame.

MGilleronFJ avatar Jul 22 '22 13:07 MGilleronFJ

I tried it in the godot4 branch and that problem did not happen. Did not happen either in the master branch. The only difference was a slight trail behind moving lines, which is normal due to the difference in execution frequencies of _physics_process and _process, but they dont remain.

Zylann avatar Jul 24 '22 18:07 Zylann