Weapon Flashlight Mount
by Travis Vroman · in Torque 3D Professional · 09/24/2009 (3:57 pm) · 4 replies
I've searched the forums for a while now, and haven't found anything that seems to work for me. All I am looking to do is mount a flashlight onto a shotgun weapon.
Now, I know about the option of setting lightType in the ShapeBaseImageData, but this only gives me part of what I need. The light appears to stay at the origin of the weapon object, and does not follow the shotgun's animation. Instead, it stays in place, which is not at all what I want. For a clearer view of what functionality I want, look at this video.
www.youtube.com/watch?v=dpNP0RerENQ
The light needs to move with the animation, and follow an animated node I have named "flashLightNode" in the mesh. This is why I am thinking the best way to accomplish this is to mount a spotlight to the node on the shotgun. However, I've yet to find a method that works in T3D - most of the posts are old, and don't seem to work for me.
I'd appreciate any help with this.
Thanks,
-Travis
Now, I know about the option of setting lightType in the ShapeBaseImageData, but this only gives me part of what I need. The light appears to stay at the origin of the weapon object, and does not follow the shotgun's animation. Instead, it stays in place, which is not at all what I want. For a clearer view of what functionality I want, look at this video.
www.youtube.com/watch?v=dpNP0RerENQ
The light needs to move with the animation, and follow an animated node I have named "flashLightNode" in the mesh. This is why I am thinking the best way to accomplish this is to mount a spotlight to the node on the shotgun. However, I've yet to find a method that works in T3D - most of the posts are old, and don't seem to work for me.
I'd appreciate any help with this.
Thanks,
-Travis
#2
Thanks for the reply. As I mentioned before, this does not give the functionality that I am looking for, as it does not allow me to position the light properly, nor does it allow the light to follow the animated mesh. It's a solution that kind of works, but in the end is not what I need.
What I need to know is how to mount a SpotLight object to a specific node on the weapon mesh itself, which is tied into an animation.
09/26/2009 (11:43 am)
@Arne, Thanks for the reply. As I mentioned before, this does not give the functionality that I am looking for, as it does not allow me to position the light properly, nor does it allow the light to follow the animated mesh. It's a solution that kind of works, but in the end is not what I need.
What I need to know is how to mount a SpotLight object to a specific node on the weapon mesh itself, which is tied into an animation.
#3
this is the line that controls the image light
it would be a nice feature, but would need someone a bit more code clever to get it to do this. (hint hint)
09/26/2009 (1:07 pm)
mm, I see what you mean.this is the line that controls the image light
image.lightInfo->setTransform( imageMat );though I have no idea how to get it to transform with the mounted image on a per animation basis.
it would be a nice feature, but would need someone a bit more code clever to get it to do this. (hint hint)
#4
For your scenario it sounds like you want the light to use the transform of the muzzle node, so as the weapon animates it points in the direction of the muzzle.
You can't simply mount to it because it's a ShapeBaseImage, in the past you couldn't anyway.
This is all speculation, I'm taking a look.
09/26/2009 (1:41 pm)
I believe this light is getting its transform from the mountNode of where the weapon is mounted. So if the weapon animates but this node doesn't move then the light won't match the weapon.For your scenario it sounds like you want the light to use the transform of the muzzle node, so as the weapon animates it points in the direction of the muzzle.
You can't simply mount to it because it's a ShapeBaseImage, in the past you couldn't anyway.
This is all speculation, I'm taking a look.
Torque 3D Owner Arne Westmeier