Game Development Community

Vehicle stops rendering after entering Zone

by Jules · in Torque 3D Professional · 08/20/2012 (7:06 pm) · 11 replies

Vehicle stops rendering, leaving only the player visible in a sitting position for a short duration, then renders again, any ideas?

Using the Cheetah.

T3D 1.2
Windows 7


#1
08/20/2012 (7:25 pm)
Try to reduce the nearClip value in the levelinfo.
#2
08/20/2012 (7:38 pm)
Thanks Alfio - I'll give it a go
#3
08/20/2012 (7:43 pm)
Nope, no joy on that one.
#4
08/20/2012 (7:53 pm)
Looks like a camera issue, looking at the vehicle from a distance, moving left shows the vehicle, then moving right makes the vehicle vanish.
#5
08/20/2012 (8:04 pm)
So my guess is that the vehicle goes inside the zone, but the camera is outside, so you can't see it. This is 3rd person by the way.

Possible fix - not sure though.
#6
08/21/2012 (1:11 am)
" A camera inside a zone can only see the outside of a zone if you add portals"
"Zones are supposed to be completely closed"
#7
08/21/2012 (1:45 am)
yeah I know that bit :) just found it strange when the vehicle goes through the zone, the player is still visible and the vehicle stops being rendered, because of the camera still being outside the zone.
#8
08/21/2012 (1:46 am)
You then have a floating player until the camera goes through the zone.

I'm trying to hide different areas of the game from being rendered until you are in that zone, so driving a vehicle on the terrain to get to each zone is when the problem showed up.
#9
08/21/2012 (3:30 am)
For now I'll place a portal but defeats the objective of stop rendering whats beyond it... thinking about it, I'll create two zones, one for the surrounding area and one for the target zone that I'm hiding.
#10
08/21/2012 (4:28 am)
I think that the reason you are seeing the player at all is due to this code in sceneManager.cpp -
//HACK: If the control object is a Player and it is not in the render list, force
   // it into it.  This really should be solved by collision bounds being separate from
   // object bounds; only because the Player class is using bounds not encompassing
   // the actual player object is it that we have this problem in the first place.
   // Note that we are forcing the player object into ALL passes here but such
   // is the power of proliferation of things done wrong.

   GameConnection* connection = GameConnection::getConnectionToServer();
   if( connection )
   {
      Player* player = dynamic_cast< Player* >( connection->getControlObject() );
      if( player )
      {
         mBatchQueryList.setSize( numRenderObjects );
         if( !mBatchQueryList.contains( player ) )
         {
            mBatchQueryList.push_back( player );
            numRenderObjects ++;
         }
      }
   }

You could follow this line of thought, and hack in the object that the player is mounted on -
GameConnection* connection = GameConnection::getConnectionToServer();
   if( connection )
   {
      Player* player = dynamic_cast< Player* >( connection->getControlObject() );
      if( player )
      {
         mBatchQueryList.setSize( numRenderObjects );
         if( !mBatchQueryList.contains( player ) )
         {
            mBatchQueryList.push_back( player );
            numRenderObjects ++;
         }
         
         // another hack to render what the player is mounted to >>
         if( player->isMounted() )
         {
            mBatchQueryList.setSize( numRenderObjects );
            SceneObject *mount = player->getObjectMount();

            if( mount && !mBatchQueryList.contains( mount ) )
            {
               mBatchQueryList.push_back( mount );
               numRenderObjects ++;
            }
         }
         // another hack to render what the player is mounted to <<
      }
   }
#11
08/21/2012 (5:09 am)
thanks Guy - worked like a charm!