Torque Lighting Kit - GuiObjectView
by John Kabus (BobTheCBuilder) · 03/07/2006 (11:22 am) · 26 comments
Download Code File
(This resource is designed for TLK 1.4)
(anyone using TGE 1.5.x should use this resource instead: TGE 1.5.x - Bonus Resource Bundle)
What are the changes?
This updated GuiObjectView uses it's own LightManager, allowing it to be used in-game without affecting the scene lighting, and also resolves a crash that occurred when exiting a mission.
The new GuiObjectView also supports env mapping on displayed models.
How to install it?
Just unzip the files into the 'engine/gui/game' directory, add them to your project, then rebuild your project - and your done!
How to use it?
Same as the previous GuiObjectView resources. For example; create a GuiObjectView control on your game's main menu, give it the name MainMenuObjectView, and exec this code in the main menu's onWake event:
Assuming "starter.fps/data/shapes/player/player.dts" is a valid path to the player dts file, the player should appear when the main menu is displayed.
The only new script method is setEmapTexture, which accepts the path to the texture used for env mapping.
Enjoy!
-John Kabus
(This resource is designed for TLK 1.4)
(anyone using TGE 1.5.x should use this resource instead: TGE 1.5.x - Bonus Resource Bundle)
What are the changes?
This updated GuiObjectView uses it's own LightManager, allowing it to be used in-game without affecting the scene lighting, and also resolves a crash that occurred when exiting a mission.
The new GuiObjectView also supports env mapping on displayed models.
How to install it?
Just unzip the files into the 'engine/gui/game' directory, add them to your project, then rebuild your project - and your done!
How to use it?
Same as the previous GuiObjectView resources. For example; create a GuiObjectView control on your game's main menu, give it the name MainMenuObjectView, and exec this code in the main menu's onWake event:
MainMenuObjectView.setObject("name", "starter.fps/data/shapes/player/player.dts", 0, 0);Assuming "starter.fps/data/shapes/player/player.dts" is a valid path to the player dts file, the player should appear when the main menu is displayed.
The only new script method is setEmapTexture, which accepts the path to the texture used for env mapping.
Enjoy!
-John Kabus
#22
I'm using:
MainMenuObjectView.mountObject("Gun1", "myGame/data/shapes/guns/gun1.dts", "paintball/data/shapes/guns/gun_texture.jpg", "mount0`", "mount0" ,1);
And as soon as I show the select player screen, it crashes out. In debug mode I get a popup instantly, telling me that 'The variable pNode' is being used without being defined. That's line 425 of guiobjectview.cc
Anyone got any idea what is causing this? I know that the player has the node called mount0 .. but what about the parent node? Isn't the object supposed to parent to the mount node? :S
Thanks for any help you guys can give. I'm pretty lost on it right now.
08/23/2006 (1:18 pm)
Well, I've finally got around to adding a gun to the player on my player select screen... unfortunately, I can't seem to get it to work!I'm using:
MainMenuObjectView.mountObject("Gun1", "myGame/data/shapes/guns/gun1.dts", "paintball/data/shapes/guns/gun_texture.jpg", "mount0`", "mount0" ,1);
And as soon as I show the select player screen, it crashes out. In debug mode I get a popup instantly, telling me that 'The variable pNode' is being used without being defined. That's line 425 of guiobjectview.cc
Anyone got any idea what is causing this? I know that the player has the node called mount0 .. but what about the parent node? Isn't the object supposed to parent to the mount node? :S
Thanks for any help you guys can give. I'm pretty lost on it right now.
#23
09/14/2006 (11:25 am)
@ James the default mainMenuGui does not have an onWake function declared inside it... you have to add it at the end of the file like such:};
};
//--- OBJECT WRITE END ---
//----------------------------------------
function mainMenuGui::onWake()
{
MainMenuObjectView.setObject("name", "starter.fps/data/shapes/player/player.dts", 0, 0);
}
#24
Nick
09/26/2006 (7:23 am)
Amazing resource! I just added it today for the inventory system and works flawless. And thanks Rubes for that great little mod to set the roation and distance. I just have trouble putting in the value in the right format for orbitDist. I get the cameraRot to work but not the orbitDist.Nick
#25
But when you want to mount an object, you need to also set the parent like this:
Nick
09/27/2006 (3:00 am)
@Jeff Murray - I don't know if you still have that problem but the solution is that when you mount an object, it needs to know the name of the parent. So for example you would first set the object like you do normaly:MainMenuObjectView.setObject("name", "myGame/data/shapes/player/player.dts", "myGame/data/shapes/player/player.png", 0);But when you want to mount an object, you need to also set the parent like this:
MainMenuObjectView.mountObject("Gun1", "myGame/data/shapes/guns/gun1.dts", "myGame/data/shapes/guns/gun_texture.jpg", "name", "mount0", 0);Nick
#26
Prior to this, I was getting crashes, inverted texture normals, warped character meshes in the viewer, etc.
Hopefully this will be helpful for someone.
05/27/2007 (12:43 pm)
This may not be of use to anyone -- but with regard to the "Fatal: (c:\work\ham\engine\ts\tsthread.cc @ 85) TSThread::selectKeyFrames: invalid keyframe!" crash bug/error, I've been able to eliminate it by issuing this command to the guiObjectView object before starting (or exiting a mission) . . .myviewer.setempty();
Prior to this, I was getting crashes, inverted texture normals, warped character meshes in the viewer, etc.
Hopefully this will be helpful for someone.

Torque Owner Scott Doerrfeld
Also strange --- when I try to use mountObject(), the object does not always mount to the node I tell it to. It sometimes shows up in random places.
Any advice would be greatly appreciated. :)