Moving A MuzzlePoint Explosion/sgLight Forward...
by CSMP · in Torque Game Engine · 10/10/2009 (12:48 am) · 4 replies
Ok, I have an Explosion being registered in my weapon's onFire methods:
My thing is that when the explosion happens the sgLight that the explosion is invoking (my main reasoning for the explosion) is happening too close to the player, I actually want the "explosion"/sgLight to be moved further forward so that the light the player is seeing actually looks like it came from ahead of the player instead of exactly at the gun's barrel(which doesnt quite look right).
I've thought about the getMuzzlePoint function and how to pass a forward offset value but can't quite understand how to do it. :(
It just doesnt look right with the sgLight coming from the MuzzlePoint position, it needs to be further forward to emulate the true lighting of a muzzleflash(imo), any help would be great!
Btw: The explosion is purely for the sgLight and not a muzzlesmoke effect so the offset would not be breaking anything, as I will animate any other MuzzleFlash effects into the model itself.
%explosion = new (Explosion)() //sgLight
{
dataBlock = MuzzleExplosion;
position = %obj.getMuzzlePoint(%slot);
};
MissionCleanup.add(%explosion);Like so.My thing is that when the explosion happens the sgLight that the explosion is invoking (my main reasoning for the explosion) is happening too close to the player, I actually want the "explosion"/sgLight to be moved further forward so that the light the player is seeing actually looks like it came from ahead of the player instead of exactly at the gun's barrel(which doesnt quite look right).
I've thought about the getMuzzlePoint function and how to pass a forward offset value but can't quite understand how to do it. :(
It just doesnt look right with the sgLight coming from the MuzzlePoint position, it needs to be further forward to emulate the true lighting of a muzzleflash(imo), any help would be great!
Btw: The explosion is purely for the sgLight and not a muzzlesmoke effect so the offset would not be breaking anything, as I will animate any other MuzzleFlash effects into the model itself.
#2
They do have a sort of weapon lighting, but the position in which I'm trying to get the light to appear at needs to be modified.
Maybe I'm going about this wrong, it just seemed the easiest way to accomplish the offset needed.
Edit: Awesomeness, I found this snippet in the shapebase.cs file:
10/10/2009 (2:10 am)
Appreciate the tip, I'll check it out... sounds like its what I need though! :)They do have a sort of weapon lighting, but the position in which I'm trying to get the light to appear at needs to be modified.
Maybe I'm going about this wrong, it just seemed the easiest way to accomplish the offset needed.
Edit: Awesomeness, I found this snippet in the shapebase.cs file:
%muzzleVector = MatrixMulVector("0 0 0 0 0 1 0", %obj.getMuzzleVector(%slot));
#3
Wow, okay. I was thinking something like
10/10/2009 (6:42 am)
I see. If you're not going through the explosion rigmarole for any reason other than to have a light, I'd suggest modifying the source to allow you to specify a light offset. You'd stick it in at ShapeBaseImage::registerLights.Wow, okay. I was thinking something like
position = %obj.getMuzzlePoint(%slot) + %obj.getMuzzleVector(%slot) * %distance;I'm not sure what MatrixMulVector does, but if it works for you, awesome.
#4
Though I will have a look at your code as well.
10/10/2009 (2:30 pm)
Actually, after trying the snippet I found its not working the way I expected it to, it was used for the Projectile Spread Resource and looked like I could pass an offset value.Though I will have a look at your code as well.
Torque Owner Daniel Buckmaster
T3D Steering Committee
Correct me if I'm wrong, but don't Images have weapon fire lighting built in already?