Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

This is a debug drawing script for 3D games made on Godot Engine

License

Notifications You must be signed in to change notification settings

DmitriySalnikov/godot_debug_draw_cs

Repository files navigation

icon

Obsolete!

Use my new GDNative addon instead https://github.com/DmitriySalnikov/godot_debug_draw_3d

Debug drawing utility

This is a debug drawing script, which you can setup as an autoload singleton. Written in C#, so only Godot Mono supported.

Inspired by Zylann's addon for the GDScript https://github.com/Zylann/godot_debug_draw

Donations

ko-fi

paypal

qiwi

Features

Primitives:

  • Box
  • Sphere
  • Cylinder
  • Line
  • Line with Arrow
  • Line Path
  • Camera Frustum
  • Billboard opaque square
  • Position 3D (3 crossing axis)

Overlay:

  • Text (with grouping and coloring)
  • FPS Graph

No need to warry about removing or disabling functionality of this addon in export builds. Everything in this addon will be disabled automatically.

Usage

  1. Copy addons/debug_draw_cs to your addon folder, create it if the folder doesn't exist.
  2. Rebuild project.
  3. Add addons/debug_draw_cs/DebugDraw.cs to your project as autoload singleton.
  4. (Optionally) Enable the Debug Draw For Editor plugin to enable debug drawing support inside the editor.

Example (information about all public static functions and properties is present inside the script):

public override void _Process(float delta)
{
    var time = OS.GetTicksMsec() / 1000f;
    var box_pos = new Vector3(0, Mathf.Sin(time * 4f), 0);
    var line_begin = new Vector3(-1, Mathf.Sin(time * 4f), 0);
    var line_end = new Vector3(1, Mathf.Cos(time * 4f), 0);

    DebugDraw.DrawBox(box_pos, new Vector3(1, 2, 1), new Color(0, 1, 0), 0, false);
    DebugDraw.DrawLine3D(line_begin, line_end, new Color(1, 1, 0));
    DebugDraw.SetText("Time", time);
    DebugDraw.SetText("Frames drawn", Engine.GetFramesDrawn());
    DebugDraw.SetText("FPS", Engine.GetFramesPerSecond());
    DebugDraw.SetText("delta", delta);
}

screenshot_3

If you see ERROR: _gl_debug_print: GL ERROR: Source: OpenGL Type: Error ID: 1281 Severity: High Message: GL_INVALID_VALUE error generated. Invalid offset and/or size., try increasing the value of rendering/limits/buffers/immediate_buffer_size_kb.

More screenshots

DebugDrawDemoScene.tscn in editor screenshot_1

DebugDrawDemoScene.tscn in play mode screenshot_2

About

This is a debug drawing script for 3D games made on Godot Engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages