Game Development Community

dev|Pro Game Development Curriculum

First/Third Person Different Weapon Models

by Chris Byars · 02/23/2006 (10:49 am) · 41 comments

This resource will allow you to have different weapon models for first and third person perspective, so the addition of high quality hands and weapon models in first person are possible without them being visible in third person view.

Now this is a cheap hack, and there's more you can do with it than I'm going to show here, as my knowledge is limited in C++ :)

One code change is all it takes. In engine/game/player.cc, in void Player::renderMountedImage(SceneState* state, ShapeImageRenderImage* rimage), change
image.shapeInstance->render();
to
if(fogExemption == true)image.shapeInstance->render(1);
else image.shapeInstance->render();

IF YOU ARE USING TSE IN MILESTONE 3.5 OR LATER
The image rendering code has been moved to shapeBase.cpp.

In engine/game/shapeBase.cpp, in void ShapeBase::prepBatchRender(...), change:
image.shapeInstance->render();
to
if(isFirstPerson())
{
   image.shapeInstance->render(1);
}
else
{
   image.shapeInstance->render();
}

What this does is, if you are in first person view, the weapon image will render at LOD 1. This LOD will contain the arms/hands and their animations as well as the weapon. All other LODs above 1 will render normally, so you make your LOD 2 the mesh that you want visible in third person view (without hands/arms).

Yes it's cheap, and you won't see your reload animations or anything like that in third person, so if you want those too you will need to script or code in some synchronizing with the player model and the weapon model's animations.

Screenshots:
First Person
Third Person

For reference:
http://www.garagegames.com/mg/forums/result.thread.php?qt=6702
Page«First 1 2 3 Next»
#41
01/12/2010 (5:00 pm)
For T3D, see www.torquepowered.com/community/forums/viewthread/109107

I can confirm that this works, I tested it with the only LODing model I had on hand at the time (Gideon) with a forced 0% LOD (so everything was min LOD aside from the first person image).

Unlike this resource, you'll want to make your arms detail level something insanely high, like 100000.+

This is technically already a T3D "feature" (unintended feature I believe), and you don't need any code changes if your players aren't allowed to tab out to 3rd person. I simply added a check for isFirstPerson to the code that already forces max detail on your control object and its mounted images.
Page«First 1 2 3 Next»