Game Development Community

Attaching lights to model

by Casey Wylde · in Torque Game Engine · 02/18/2008 (12:07 pm) · 4 replies

I've searched the forums quite thoroughly but haven't found anything explaining how to setup a mount node on a model, and attach a light to it. I have a lamppost and want to attach a light to it. I can't seem to line it up correctly by manually moving it in the world editor. Any help would be greatly appreciated.

#1
02/20/2008 (11:55 pm)
I don't think you can do that. At least, I doubt it seriously.

The thing to do would be to place it in the appropriate place in the world editor. It does take practice to do that, though--trust me, I know--but it is possible to develop techniques to place things fairly precisely in there.

Don't forget you can also just edit the position of the light manually in your mission file, too. Tedious, but effective.
#2
02/21/2008 (1:23 am)
To do this, you need a classical mountPoint, and the command

myLightObject.attachToObject( objectThatWillCarryTheLight );

The question now is : how can I specify the mount point on which I want to attach the light ?

The answer is : by fields in the light datablock :

MountPoint = "0";    // the mountPoint to attach the object "3" will attach to "mount3"
   MountPosition = "-3 -3 -3";    // an offset of the light from the mountPoint position
   MountRotation = "1 0 0 0";    // the orientation of the light (surely dependant on the base object orientation)

Nicolas Buquet
www.buquet-net.com/cv/
#3
02/21/2008 (12:09 pm)
Holy cow! I didn't know you could do that!

Cool!

@Casey: did you get it working with Nicolas' instructions?
#4
02/21/2008 (4:42 pm)
This helped a lot! Thanks so much Nicolas!