Game Development Community

Mounted lights

by Dave D · in Torque Game Engine · 01/12/2006 (12:36 pm) · 3 replies

Someone have, or can point me to an example of how to use:
.attachToObject()

What I am trying to do is mount a light to a helmut. I read the pdf for tlk and even did a search, but keep coming up empty.

#1
01/12/2006 (1:13 pm)
Nevermind, I figured it out. Spelling error on my part
#2
01/12/2006 (1:17 pm)
Assuming the helmet is part of the player and not a mounted image: make sure your helmet has a mount point on it, then when want to attach a light create a light for the player and call the following code:

yourLight.attachToObject(yourPlayer);

At this point the light should be attached to the player (probably at mount 0), if you are using a different mountpoint then change the light datablock property MountPoint to the mountpoint number.

For an example for how to dynamically create a light and attach it to an object see the TLK example scripts in 'starter.fps/server/scripts/sgExamples.cs', and check out the SpotSwing example.

-John
#3
01/12/2006 (1:20 pm)
Actually the helmut is a mounted image. I was typing in the mount point wrong. Too much coffee and cough syrup I think.