Skip to content

Debug draw (planned)

Note: Not built yet. This page is a design note for a planned feature. The API below is a proposal, not part of the current engine. Names may change before release.

  • Implement the engine-side debug draw.
  • Expose it to the C# Kolpa.Engine API.
  • Replace the proposed calls below with the real signatures.
  • Regenerate reference/ so the new types appear.

Draw 3D wireframes from C#. Supported shapes: line, polyline, box, sphere, capsule, cylinder, cone, plane, cross, and arrow.

Each shape would last one frame. Call it again next frame if you still want it. OnUpdate is the usual place.

using Kolpa.Engine;
public override void OnUpdate(float deltaTime)
{
DebugDraw.Line(new Vector3(0, 1, 0), new Vector3(0, 3, 0), new Color(255, 51, 26));
DebugDraw.Sphere(new Vector3(2, 1, 0), 0.5f);
}

Color would be a Color. If left out it would default to white.

DebugDraw.Clear() would drop anything queued that has not been drawn yet.

Note: A vertex cap would drop the rest of that frame if a script queues too much, and the log would warn once. A polyline would keep the first 4096 points.

Call What you pass
DebugDraw.Line Start, end, optional color.
DebugDraw.Lines A list of Vector3 points, optional color.
DebugDraw.Box Center, half extents.
DebugDraw.Sphere Center, radius.
DebugDraw.Capsule Center, radius, length of the straight middle.
DebugDraw.Cylinder Center, half extents. X and Z are the radii. Y is half the height.
DebugDraw.Cone Apex, range, half angle in radians. The cone opens along local +Z.
DebugDraw.Plane Center, normal, size.
DebugDraw.Cross Center, size.
DebugDraw.Arrow Start, end, optional color.

Sphere, capsule, cylinder, and cone would take an optional segment count after the color. The default would be 16. Values outside 3 to 48 would be clamped.

Previous: Steam: achievements, stats, presence, and cloud saves, planned.

Next: MCP server: AI lookup server, planned.