Game Development Community

TGEA 1.7.1 RenderFirstPerson field not working

by Jaimi McEntire · in Torque Game Engine Advanced · 10/21/2008 (1:59 pm) · 5 replies

The RenderFirstPerson field does not work - If you're in 3rd person view, the shape is always rendered. To fix this, do the following:

In player.h, Add this line:

// Fix RenderFirstPerson flag
   virtual void prepBatchRender( SceneState *state, S32 mountedImageIndex );

right after this declaration in the Player class:
void setPosition(const Point3F& pos,const Point3F& viewRot);

Now, add the following function in the player class itself (in player.cpp):

// Fix RenderFirstPerson flag
void Player::prepBatchRender( SceneState *state, S32 mountedImageIndex )
{
   if (mDataBlock && (!mDataBlock->renderFirstPerson) && this->isFirstPerson())
   {
      if (mountedImageIndex >= 0)
      {
         ShapeBase::prepBatchRender(state,mountedImageIndex);
      }
   }
   else
   {
      ShapeBase::prepBatchRender(state,mountedImageIndex);
   }
}

Now, if RenderFirstPerson is set to false, your avatar will not be rendered. However, any mounted objects (such as your weapon) will still be rendered, and so will your shadow.

#2
10/21/2008 (2:45 pm)
Hmm - I did, but it seems more complicated than this version, and it appears hardcoded. Before I go through and test this, is it better than this solution? Can you turn it on and off? Does it render the shadow?
#3
10/24/2008 (8:26 pm)
This doesn't work unfortunately, because while the shadow is rendered, it isn't animated
#4
10/24/2008 (11:14 pm)
Strange - it animates for me. I'm using tgea+afx - are you using the same version?
#5
10/25/2008 (6:16 pm)
No, just plain TGEA 1.7.1... We were doing same too, but using the prepRenderImage function and saw same issue with shadows not rendering, but only correlation was not rendering avatar in first person