Attaching a light to a ShapeBase object
by Denise Bacher · in Torque Game Engine · 09/24/2007 (10:33 am) · 2 replies
I've read this post (http://www.garagegames.com/mg/forums/result.thread.php?qt=26189) as well as a few others on this topic, and it seems like it should be fairly straight forward to attach a light to an object. But I still haven't been able to get it to work.
What I'm trying to do is attach an omni light to my flying vehicle. I don't really care where the light attaches at the moment, only that it does and that it moves around with my vehicle. What I'm currently trying is I've defined a fxLightData datablock "mLight", then in my flyingVehicle datablock I've included className = "Light" and defined:
This isn't working, and %light isn't being assigned a value. Can anyone give me some insight or guidance on how to accomplish this.
Thanks,
Denise
What I'm trying to do is attach an omni light to my flying vehicle. I don't really care where the light attaches at the moment, only that it does and that it moves around with my vehicle. What I'm currently trying is I've defined a fxLightData datablock "mLight", then in my flyingVehicle datablock I've included className = "Light" and defined:
function Light::onAdd(%this,%obj)
{
%light = new fxLight()
{
dataBlock = "mLight";
client = %this;
selected = "0";
};
%light.attachToObject(%obj);
}This isn't working, and %light isn't being assigned a value. Can anyone give me some insight or guidance on how to accomplish this.
Thanks,
Denise
#2
also in the onAdd function I changed it from lightFalloffMono.png to corona.png
09/25/2007 (1:25 pm)
Here's my datablock for making an omni light.datablock sgUniversalStaticLightData(sgMountLight)
{
className = "sgUniversalStaticLightData";
LightOn = "1";
Radius = "1";
Brightness = "1";
Colour = "1.000000 0.976471 0.941177 1.000000";
FlareOn = "1";
FlareTP = "1";
FlareBitmap = "common/lighting/corona";
FlareColour = "1.000000 1.000000 1.000000 1.000000";
ConstantSizeOn = "0";
ConstantSize = "0.4";
NearSize = "0.4";
FarSize = "0.6";
NearDistance = "3";
FarDistance = "10";
FadeTime = "0.1";
BlendMode = "0";
AnimColour = "0";
AnimBrightness = "0";
AnimRadius = "0";
AnimOffsets = "0";
AnimRotation = "0";
LinkFlare = "1";
LinkFlareSize = "0";
MinColour = "0.000000 0.000000 0.000000 1.000000";
MaxColour = "1.000000 0.976471 0.941177 1.000000";
MinBrightness = "0";
MaxBrightness = "0.37931";
MinRadius = "0.1";
MaxRadius = "0.85";
StartOffset = "-5 0 0";
EndOffset = "5 0 0";
MinRotation = "0";
MaxRotation = "359";
SingleColourKeys = "1";
RedKeys = "AZA";
GreenKeys = "AZA";
BlueKeys = "AZA";
BrightnessKeys = "AZA";
RadiusKeys = "AZA";
OffsetKeys = "AZA";
RotationKeys = "AZA";
ColourTime = "5";
BrightnessTime = "5";
RadiusTime = "5";
OffsetTime = "5";
RotationTime = "5";
LerpColour = "1";
LerpBrightness = "1";
LerpRadius = "1";
LerpOffset = "1";
LerpRotation = "1";
StaticLight = "0";
SpotLight = "0";
SpotAngle = "0";
AdvancedLightingModel = "0";
EffectsDTSObjects = "1";
CastsShadows = "1";
DiffuseRestrictZone = "1";
AmbientRestrictZone = "0";
LocalAmbientAmount = "0";
SmoothSpotLight = "0";
DoubleSidedAmbient = "0";
LightingModelName = "SG - Original Stock (Lighting Pack)";
UseNormals = "1";
MountPoint = "0";
MountPosition = "0 0 0";
MountRotation = "-1 0 0 90";
};also in the onAdd function I changed it from lightFalloffMono.png to corona.png
Torque 3D Owner Chad Kilgore
%light = new volumeLight() { [b]dataBlock = "sgMountLight";[/b] rotation = "-0.357694 0.933839 9.9834e-009 180"; scale = "1 1 1"; Enable = "1"; IconSize = "1"; ParticleColorAttenuation = "1"; Texture = "common/lighting/lightFalloffMono.png"; lpDistance = "0.35"; ShootDistance = "5"; Xextent = "0.6"; Yextent = "0.6"; SubdivideU = "4"; SubdivideV = "4"; FootColour = "1.000000 1.000000 1.000000 0.182000"; TailColour = "0.000000 0.000000 0.000000 0.000000"; }; %light.attachToObject(%object);This example makes spotlights. However, even after I change the sgMountLight datablock so SpotLight = 0, it still renders a spotlight. Does anybody know how to setup an omni light? Thanks.