Making character invisible to camera in first perosn mode
by David Dougher · in Torque Game Engine Advanced · 10/19/2006 (6:52 pm) · 14 replies
I seem to remember that at one time there was a way to make the character invisible to the eye camera when the player shifted from third person to first person mode. Does anyone remember what it is? I have been crawling over the forums and TDN for three days now and I just can't seem to find the right combination of search words to come up with an answer...
The only thing I have been able to find in the documentation was a reference to two prefs files
$pref::Player::renderMyItems = "1";
$pref::Player::renderMyPlayer = "1";
I thought the latter was my ticket, but it seems to do nothing in TSE. Whether the value is set to 0 or 1 the character still renders.
The only thing I have been able to find in the documentation was a reference to two prefs files
$pref::Player::renderMyItems = "1";
$pref::Player::renderMyPlayer = "1";
I thought the latter was my ticket, but it seems to do nothing in TSE. Whether the value is set to 0 or 1 the character still renders.
About the author
Owner - Pariah Games, Adjunct Professor - Bristol Community College, Mentor - Game Design - Met School Newport, Mentor - Game Design - Met School Providence
#2
But it does bring up one rather odd problem. I searched for this solution through the forums using words like "first person" (and I spelled it correclty, unlike my mistake above) "hiding", "camera" and several other criteria in various combinations but I never found your post. I made sure I was logged in so I had access to all the forums - so it should have turned up. In fact, I should have found it easily with the search criteria I was using. So why didn't I ever see it?
Could there be an issue with the search engine and restricted forums? A question for another forum.
In the meantime, thanks again. This will save me hours of work.
10/20/2006 (6:50 am)
Thanks to you, and to Stefan!But it does bring up one rather odd problem. I searched for this solution through the forums using words like "first person" (and I spelled it correclty, unlike my mistake above) "hiding", "camera" and several other criteria in various combinations but I never found your post. I made sure I was logged in so I had access to all the forums - so it should have turned up. In fact, I should have found it easily with the search criteria I was using. So why didn't I ever see it?
Could there be an issue with the search engine and restricted forums? A question for another forum.
In the meantime, thanks again. This will save me hours of work.
#3
On the forum search thing: Recent posts might not have been indexed yet, not sure. But I rarely can find forum posts that are recent.
10/20/2006 (8:24 am)
Gee, is my name so hard to spell? (:On the forum search thing: Recent posts might not have been indexed yet, not sure. But I rarely can find forum posts that are recent.
#4
Corrected. Sorry about that. By the way I tried the changes you listed and it doesn't seem to work.
Here's basically what I did.
Added the function to the player.h file as stated.
Copied over the prepBatchRender from Shapebase to player.cpp renaming it to Player::prepBatchRender
Added the "else if" code you specified to the routine
Added
bool renderPlayer = true;
renderPlayer = mDataBlock->renderFirstPerson;
Just after the initial comment in the else if routine.
Changed the comparison from
else if ( !isFirstPerson() || renderFirstPerson )
to
else if ( !isFirstPerson() || renderPlayer )
That's it.
It compiles no problem. However, there is no change to the player no matter how I set the
$prep::Player::renderMyPlayer variable.
My assumption is that this routine is not being called - the Shapebase one is. Do I also need to add a prepRenderImage function to the player file?
10/20/2006 (9:59 am)
Ooooooopppsss!Corrected. Sorry about that. By the way I tried the changes you listed and it doesn't seem to work.
Here's basically what I did.
Added the function to the player.h file as stated.
Copied over the prepBatchRender from Shapebase to player.cpp renaming it to Player::prepBatchRender
Added the "else if" code you specified to the routine
Added
bool renderPlayer = true;
renderPlayer = mDataBlock->renderFirstPerson;
Just after the initial comment in the else if routine.
Changed the comparison from
else if ( !isFirstPerson() || renderFirstPerson )
to
else if ( !isFirstPerson() || renderPlayer )
That's it.
It compiles no problem. However, there is no change to the player no matter how I set the
$prep::Player::renderMyPlayer variable.
My assumption is that this routine is not being called - the Shapebase one is. Do I also need to add a prepRenderImage function to the player file?
#5
@Stefan - Sorry lol.
10/20/2006 (3:38 pm)
You're correct with that assumption - You'll need to create a prepRenderImage(); function for Player aswell.@Stefan - Sorry lol.
#6
10/21/2006 (11:59 am)
.
#7
10/21/2006 (12:19 pm)
So all working? I got it in my build and it works so it could very well be that I forgot to include something.
#8
@Berserk Nice idea but a quick check shows that the variable currently does nothing in the code. It can be set from the datablock to false is defaulted to true in code initialization, is streamed to and from the system, but has no other efffect than to be passed around... It is not used anywhere in the rendering of the character for TSE.
10/21/2006 (12:32 pm)
@ Stefan - Nope. Still haven't written the prepRenderImage piece yet. Been preparing the house for winter :(@Berserk Nice idea but a quick check shows that the variable currently does nothing in the code. It can be set from the datablock to false is defaulted to true in code initialization, is streamed to and from the system, but has no other efffect than to be passed around... It is not used anywhere in the rendering of the character for TSE.
#9
10/21/2006 (1:37 pm)
Mincentro outlined why it does not work in TSE anymore, they changed how those functions (prepBatchRender, for instance) work and where it is called.
#10
10/21/2006 (4:09 pm)
This is the one I'm usingbool Player::prepRenderImage(SceneState* state, const U32 stateKey,
const U32 /*startZone*/, const bool /*modifyBaseState*/)
{
if (isLastState(state, stateKey))
return false;
setLastState(state, stateKey);
if (mHidden == true )
return false;
// This should be sufficient for most objects that don't manage zones, and
// don't need to return a specialized RenderImage...
if (state->isObjectRendered(this))
{
prepBatchRender( state, -1 );
}
}It doesn't display mounted objects or render player shadows though. It wasn't really a dire need for my game, It was a bit tedious tryig to get the shadows to work so I gave up lol.
#11
10/22/2006 (10:17 am)
.
#12
The methods I've used (mainly commenting out alot of stuff) isn't really producing working results.
10/24/2006 (6:03 am)
Hey, does anybody know how to get Mounted Images rendering?The methods I've used (mainly commenting out alot of stuff) isn't really producing working results.
#14
10/26/2006 (5:03 am)
Don't worry, I got mounted items rendering ;)
Torque 3D Owner iHugMedia
Stephan Lundmark kindly provided a fix for it.