Game Development Community

how to not render the control object?

by kcpdad · in Torque 3D Professional · 08/20/2011 (12:06 pm) · 3 replies

I'm using a vehicle as the control object, I would like to not see the vehicle at all.

In tge there was a function called renderObject wherein I just checked if this was a ghost and if not I wouldn't call the parent's renderobject which made the vehicle disappear for the person controlling it.

Would anyone happen to know of a way to do this in t3d? thanks

About the author

Hobbyist working on a tank game when time allows. Play the prototype at => http://www.sytrept.com/60tons/


#1
08/20/2011 (12:18 pm)
Maybe THIS can help you?
#2
08/20/2011 (12:46 pm)
That definitely helped Alfio.

That code fixes a use case where the control object is not already part of the list of objects to render(mBatchQueryList). If the control object is already a member of the that list then commenting it out won't prevent it from being displayed.

So I change the code, see below, and it works fine so far. It displays the vehicle in 3rd person mode and not in 1st person mode.

Thanks!

if( connection )
{
   ShapeBase* player = dynamic_cast< ShapeBase* >( connection->getControlObject() );
   // Vehicle* vehicle = dynamic_cast< Vehicle* >( connection->getControlObject() );
   if( player && player->isFirstPerson())
   {
      if( mBatchQueryList.contains( player ) )
      {
         mBatchQueryList.remove( player );
         numRenderObjects --;
      }
   }
}
#3
08/21/2011 (4:40 am)
For some reason dynamically casting to Vehicle causes a compilation problem. Not sure why, both Player and Vehicle inherit from ShapeBase. Maybe because one is a net object and the other is a console object?