Game Development Community

Hiding the Player Model in first person

by iHugMedia · in Torque Game Engine Advanced · 10/17/2006 (2:23 am) · 12 replies

(Sorry if this was posted already, the search didn't turn up anything but we all know that doesn't mean much).

The renderFirstPerson property doesn't seem to do anything in game, I've noticed in the source code the RenderImage function doesn't seem to exist in TSE's player.cpp like it does in TGE (I didn't really expect it to lol).
Can anybody give me some direction or insight into going about adding this function in again?

#1
10/17/2006 (3:45 am)
Hi Mincentro,

In player.h, add:
void prepBatchRender( SceneState *state, S32 mountedImageIndex );

Then take prepBatchRender (); from ShapeBase and put it in Player.

In player.cpp inside prepBatchRender (); find this:
else
{
   MatrixF mat = getRenderTransform();
   mat.scale( mObjScale );
   GFX->setWorldMatrix( mat );

   mShapeInstance->animate();
   mShapeInstance->render();
}

Change it, into this:
// Do not render the control object if we are in first person. 
// I forgot why we do not need
// to check this != controlObject. 
else if ( !isFirstPerson() || renderFirstPerson )
{
   MatrixF mat = getRenderTransform();
   mat.scale( mObjScale );
   GFX->setWorldMatrix( mat );

   mShapeInstance->animate();
   mShapeInstance->render();
}
#2
10/17/2006 (12:30 pm)
Heh I did a cheap hack to fix that a while ago, yours is much cleaner. :)
#3
10/17/2006 (11:32 pm)
Okay, I just made the source changes and got it compiling, but it's not calling the Player::prepBatchRender(); function, it's still calling the ShapeBase::prepBatchRender(); function to render the players.
In order to get it compiling though I needed to add
bool renderPlayer = true;
   renderPlayer = mDataBlock->renderFirstPerson;
to Player::prepbatchrender();

I noticed for the explosion and particle system it also uses the prepRenderImage(); function, when I added this to Player prepBatchRender() was called but Torque crashed. I've probably overlooked something simple at this point.
#4
10/18/2006 (12:05 am)
No, I probably forgot to include something else. I am sorry, it was late. I know I too have prepRenderImage () added and it works.
#5
10/18/2006 (1:56 am)
Thats okay ;)
I'll fiddle around with it tomorrow to get it working. Thanks for the starting point though, it's very much appreciated.
#6
10/18/2006 (3:25 am)
It's just a matter of making sure the Player method is called instead of the ShapeBase one. The above *is* the solution :)
#7
01/03/2007 (12:43 pm)
Has anyone been able to get this to work on MS4? It crashes the game.
#8
01/03/2007 (1:07 pm)
I use the above in MS4.
#9
01/03/2007 (1:44 pm)
Stefan, I emailed you from public profile.
#10
01/03/2007 (2:53 pm)
Received and replied to, thanks.
#11
01/03/2007 (4:36 pm)
I followed these instructions, even started from scratch twice, and it still won't work. It doesn't like this:

else if ( !isFirstPerson() || renderFirstPerson )

Doesn't like the "renderFirstPerson" part, says something about it not being identified.
#12
01/04/2007 (12:23 pm)
Just a note here. The above changes no longer work in the later incarnation of MS4.
Just thought I'd mention it to anyone else bumping into this thread later on.

Cheers.