Game Development Community

renderFirstPerson dependent on weapon datablock

by J.P. Berry · in Torque Game Engine · 07/22/2010 (12:40 am) · 2 replies

First off, I'm a little embarrassed I haven't figured this out yet, but I figure it's time to swallow my pride and get some good ol' fashioned help from the community!

I have a few different weapons in my game. Some of them I want to have renderFirstPerson enabled (the character model), and others I do not. For example, I may want to show the players body when using a knife, but I may want to hide the players body when I'm using a gun that is using an eye offset.

Any ideas on how to accomplish this through script?

Thanks!

#1
07/22/2010 (12:48 am)
As far as I'm aware, in script: "It can't be done!"

If you want to mimic this effect, you could do what many games resort to and just model arms on the knife mesh (gun meshes too, if you want). Or you could go the route I took and make the player visible and animated all the time (the REAL MAN's first-person experience :P).

Or, to actually get the functionality you want, you could make a pretty simple modification to the source code. Since renderFirstPerson is a datablock member at the moment, you could change it to an object member, and add some console get/set methods to access it. So when your knife is mounted, you can set the character to be renderable in first person - and when other things are mounted, you turn off FP rendering.
#2
07/22/2010 (10:41 pm)
Thanks, Daniel. My first inclination was to set some console methods up, but I figured there might be some clever way of doing it through script.

My engine codebase has gotten pretty out of control these days, so I'm not going to touch it for now. I'm *trying* to start focusing on all things GUI and script related now, but my compiler has it's way of bringing me back in for more. It is nice to be at a point where I can almost assuredly say my codebase is %80 complete.. almost.

So I'm going to stick with all things renderFirstperson=true for now, as it should be ;) Unless someone else could use this functionality, in which case, *looks back at compiler*..