Game Development Community

Path Markers are hard to see and position

by Jaimi McEntire · in Torque 3D Professional · 08/03/2009 (7:39 pm) · 3 replies

When selected, you see a giant gizmo, and it's hard to tell where they are in the world. Especially on the first one, where there are no arrows.

So - I changed the way they render. In Simpath.cpp, change your Marker::renderObject like this:

void Marker::renderObject(ObjectRenderInst *ri, SceneState *state, BaseMatInstance* overrideMat)
{
   initGFXResources();
   
   for(U32 i = 0; i < GFX->getNumSamplers(); i++)
      GFX->setTexture(i, NULL);
   GFXTransformSaver saver;
   MatrixF mat = getRenderTransform();
   mat.scale(mObjScale);
   GFX->multWorld(mat);

   // Draw the markers a little bigger.  
   GFXStateBlockDesc desc;
   desc.setBlend( false );
   desc.setZReadWrite( true, true );

   GFXDrawUtil *drawer = GFX->getDrawUtil();

   Point3F p0(0.0f,0.0f,0.0f);
   Point3F p1(0.0f,0.0f,2.0f);
   ColorI col(0xff,0x5f,0x00);

   drawer->drawCone( desc, p0, p1, 1.0f, col);
}

Don't forget to add the needed header for GFXDrawUtil also:

#include "gfx/gfxDrawUtil.h"

Now, it will render an Orange Cone, like a traffic marker. A Big, easy to see, traffic marker that interacts with the zbuffer so you can tell when it's on the ground. In Advanced Lighting Mode, the fog messes it up, and gives it a psychodelic look. So switch to basic lighting, or just blow it off (that's what I did). I'd like to change it so they actually cast shadows, and you can really see where they are, but I haven't gotten around to it yet.

#1
08/05/2009 (8:37 am)
I will use this, thanks!
#2
08/10/2009 (10:50 am)
I added this. It is actually quite nice. Thank you, Jaimi.
#3
08/11/2009 (6:43 pm)
Thanks! I'll try to make it a bit better, so it actually shadows (etc).