Archive 17/01/2023.

[SOLVED] Draw a line

lexx

How to draw a line (x1,y1 to x2,y2) ?

jmiller

Hi lexx,

So far, I see this but have not used it:

urho3d.github.io/documentation/a00270.html

Mike

You can draw lines using DebugRenderer, check example 15_Navigation, some lines and boxes are drawn for the path (see HandlePostRenderUpdate() function).

lexx

Thanks guys, will check these asap. Not for debugging purposes but lines are lines

[edit]
Ok, checked those and these uses DebugRenderer, and so do I.

init:
	scene_->CreateComponent<DebugRenderer>();

update():
   ...
	DebugRenderer* debug = scene_->GetComponent<DebugRenderer>();
	debug->AddLine(Vector3(0, 0, 0), Vector3(mx, my, 0), Color(1, 1, 1, 1), false);