module Lapis::Docs::GENERAL::PRIMITIVES

Overview

Diorite Primitives Reference

Complete guide to all 26 procedural 2D and 3D debug drawing primitives supported by Diorite.

Overview

Diorite provides 26 high-performance debug primitives spanning standard geometric shapes, camera helpers, physics telemetry indicators, motion trails, and canvas UI overlays. Each primitive is available via procedural DebugDraw methods with customizable colors, line widths, and durations.

Key Topics

Topic Description
3D Primitives Line, Arrow, Box, Sphere, Cylinder, Capsule, Vision Cone, Plane, Grid, Gizmo, Position 3D, Frustum, Points, Path, Spring, Ruler, Reticle, Surface Disk, Ray Hit, Trajectory Arc, Text 3D, and Motion Trails.
2D Primitives Line 2D, Arrow 2D, Rect 2D, Circle 2D, Points 2D, Path 2D, Text 2D, and Real-time Telemetry Graphs.

Code Examples

Drawing 3D Primitives

DebugDraw.line_3d(v0, v1, Godot::Color.new(1, 0, 0))
DebugDraw.arrow_3d(from, to, Godot::Color.new(0, 1, 0), head_size: 0.3_f32)
DebugDraw.sphere_3d(center, radius: 1.5_f32, rings: 16)
DebugDraw.camera_frustum_3d(pos, basis, fov: 60.0_f32, near: 0.1_f32, far: 50.0_f32, aspect: 1.777_f32)
DebugDraw.trajectory_arc_3d(origin, velocity, gravity, max_time: 2.0_f32, steps: 25)
DebugDraw.ruler_3d(ptA, ptB, tick_size: 0.2_f32)

Drawing 2D Primitives and Telemetry

DebugDraw.line_2d(Godot::Vector2.new(0, 0), Godot::Vector2.new(100, 100))
DebugDraw.circle_2d(Godot::Vector2.new(200, 200), radius: 30.0_f32)
DebugDraw.rect_2d(Godot::Rect2.new(10, 10, 100, 50))
DebugDraw.stat_graph_2d("Player Speed", player.velocity.length)

Pitfalls & Best Practices

Frequently Asked Questions

Defined in:

docs/general/primitives.cr

Class Method Summary

Class Method Detail

def self.example_01_drawing_3d_primitives : Nil #

Example: Drawing 3D Primitives

DebugDraw.line_3d(v0, v1, Godot::Color.new(1, 0, 0))
DebugDraw.arrow_3d(from, to, Godot::Color.new(0, 1, 0), head_size: 0.3_f32)
DebugDraw.sphere_3d(center, radius: 1.5_f32, rings: 16)
DebugDraw.camera_frustum_3d(pos, basis, fov: 60.0_f32, near: 0.1_f32, far: 50.0_f32, aspect: 1.777_f32)
DebugDraw.trajectory_arc_3d(origin, velocity, gravity, max_time: 2.0_f32, steps: 25)
DebugDraw.ruler_3d(ptA, ptB, tick_size: 0.2_f32)

[View source]
def self.example_02_drawing_2d_primitives_and_telemetry : Nil #

Example: Drawing 2D Primitives and Telemetry

DebugDraw.line_2d(Godot::Vector2.new(0, 0), Godot::Vector2.new(100, 100))
DebugDraw.circle_2d(Godot::Vector2.new(200, 200), radius: 30.0_f32)
DebugDraw.rect_2d(Godot::Rect2.new(10, 10, 100, 50))
DebugDraw.stat_graph_2d("Player Speed", player.velocity.length)

[View source]
def self.topic_01_3d_primitives : Nil #

3D Primitives: Line, Arrow, Box, Sphere, Cylinder, Capsule, Vision Cone, Plane, Grid, Gizmo, Position 3D, Frustum, Points, Path, Spring, Ruler, Reticle, Surface Disk, Ray Hit, Trajectory Arc, Text 3D, and Motion Trails.


[View source]
def self.topic_02_2d_primitives : Nil #

2D Primitives: Line 2D, Arrow 2D, Rect 2D, Circle 2D, Points 2D, Path 2D, Text 2D, and Real-time Telemetry Graphs.


[View source]