Game Development Community

dev|Pro Game Development Curriculum

Drawing Debug Lines

by Playware · 06/19/2009 (12:41 am) · 3 comments

1. Uncomment the #define ENABLE_DEBUGDRAW in engine\source\gfx\debugDraw.h
2. In debugDraw.cpp, render() function, in case DebugPrim::Box change to this
GFX->getDrawUtil()->drawWireCube(d * 0.5, (p->a + p->b) * 0.5, p->color);
3. These debug primitives have life time field called dieTime. If you don't want it and want to render them all the time
comment these lines near the bottom of render() function.
if(p->dieTime <= curTime && !isFrozen)
{
   *walk = p->next;
   mPrimChunker.free(p);
}
else
4. Compile.
5. From script, you can use these draw functions, for eg like:
debugdraw.drawline(heli1.getposition(), heli2.getposition())

Enjoy!

#1
06/20/2009 (11:36 am)
Thanks for the resource, I think its great, I learn so much from snippets like this.
#2
06/20/2009 (4:07 pm)
Hmm i wonder if this can be modded for showing cast radius... Gotta try this later...
#3
06/28/2009 (1:28 pm)
I'm about to see if this works on Torque3D...hoping for the best