Game Development Community

Mounted Lights

by JPaxson · in Torque Game Engine Advanced · 04/26/2007 (9:44 am) · 3 replies

A couple of questions really.

My mounted lights mounted via the attachToObject function. I have 2 mounted as headlights and 2 as tail lights. They show completely through the vehicle mesh like the vehicle isnt even there. Is there a way to make this work like one would expect? Or is this another TGEA "feature"?

Second. when i create a light object is there no way to maintain a reference to it other than by a global name in script? I can mod the code, but im sick of fixing Torque everytime i want to do something? Any script trick(s)?

The lighting stuff documents have nada for docs on mounted lights, so any help is appreciated.

#1
04/26/2007 (9:57 am)
You didn't mention where you want to reference it from. Something similar to the following should work in your vehicle's script.

%mylight = this.getMountedObject([i]slot#[/i])
#2
04/26/2007 (11:23 am)
Your script "trick":
%vehicle.leftHeadLight = someLightCreationFunction();

Great thing about TorqueScript is that you can just make up new member variables of objects on the fly and stuff whatever you want in there. After you perform the code above, you can grab a "handle" to that light simply by using %vehicle.leftHeadLight
#3
04/27/2007 (12:55 pm)
Thanks, Mark. That was more or less what i ended up coming up with. I ended up making the light reference a dynamic datablock variable and away i went.