This is an add-on for debug drawing in 3D and for some 2D overlays, which is written in C++
and can be used with GDScript
.
Based on my previous addon, which was developed only for C# https://github.com/DmitriySalnikov/godot_debug_draw_cs, and which was inspired by Zylann's GDScript addon https://github.com/Zylann/godot_debug_draw
Your support adds motivation to develop my public projects.
3D Primitives:
- Arrow
- Billboard opaque square
- Box
- Camera Frustum
- Cylinder
- Gizmo
- Grid
- Line
- Line Path
- Line with Arrow
- Points
- Position 3D (3 crossing axes)
- Sphere
Overlay:
- Text (with grouping and coloring)
- FPS Graph
- Custom Graphs
Precompiled for:
- Windows
- Linux
- macOS
- Android
To download, use the Godot Asset Library or download the archive by clicking the button at the top of the main repository page: Code -> Download ZIP
, then unzip it to your project folder. Or use one of the stable versions from the GitHub Releases page (just download one of the "Source Codes" in assets).
- Copy
addons/debug_draw_3d
to youraddons
folder, create it if the folder doesn't exist - Restart the editor
More examples can be found in the examples_dd3d/
folder.
Simple test:
func _process(delta: float) -> void:
var _time = Time.get_ticks_msec() / 1000.0
var box_pos = Vector3(0, sin(_time * 4), 0)
var line_begin = Vector3(-1, sin(_time * 4), 0)
var line_end = Vector3(1, cos(_time * 4), 0)
DebugDraw.draw_box(box_pos, Vector3(1, 2, 1), Color(0, 1, 0))
DebugDraw.draw_line(line_begin, line_end, Color(1, 1, 0))
DebugDraw.set_text("Time", _time)
DebugDraw.set_text("Frames drawn", Engine.get_frames_drawn())
DebugDraw.set_text("FPS", Engine.get_frames_per_second())
DebugDraw.set_text("delta", delta)
A list of all functions is available in the documentation inside the editor.
Besides DebugDraw
, you can also use Dbg3
.
DebugDraw.draw_box_xf(Transform3D(), Color.GREEN)
Dbg3.draw_box_xf(Transform3D(), Color.GREEN)
But unfortunately at the moment GDExtension
does not support adding documentation.
Enabling occlusion culing can lower fps instead of increasing it. At the moment I do not know how to speed up the calculation of the visibility of objects.
The text in the keys and values of a text group cannot contain multi-line strings.
The entire text overlay can only be placed in one corner, unlike DataGraphs.
Frustum of Camera3D does not take into account the window size from ProjectSettings.
The C# binding is not ready yet.