Disable glow and emissive via script?
by Andy Hubbard · in Torque 3D Professional · 01/21/2011 (6:24 am) · 2 replies
Hi all,
I am trying to run a timeofday event that disables/enables glow and emissive on a material.
Code so far:
The relevant materials get modified, I can look in the material editor and the glow/emissive state has changed. What I cannot get to work is for the material to actually update in the game. After looking at the material in the material editor it updates on the static - but not before I do that.
Any ideas?
Cheers,
Andy
I am trying to run a timeofday event that disables/enables glow and emissive on a material.
Code so far:
function TimeOfDay::onAdd( %this )
{
%this.addTimeOfDayEvent( 0, "Sunrise" );
%this.addTimeOfDayEvent( 180, "Sunset" );
}
function TimeOfDay::onTimeEvent( %this, %identifier, %currentTime, %currentElevation )
{
%lightsEnabled = ( ( %identifier $= "Sunrise" ) ? false : true );
%glowEnabled = ( ( %identifier $= "Sunrise" ) ? 0 : 1 );
%emissiveEnabled = ( ( %identifier $= "Sunrise" ) ? 0 : 1 );
LampPost.setLightEnabled( %lightsEnabled ); // turn on/off point light
LampPost01_material_0.glow[0] = %glowEnabled; // turn on/off material_0 glow
LampPost01_material_2.glow[0] = %glowEnabled; // turn on/off material_2 glow
LampPost01_material_2.emissive[0] = %emissiveEnabled; // turn on/off material_2 emissive
}The relevant materials get modified, I can look in the material editor and the glow/emissive state has changed. What I cannot get to work is for the material to actually update in the game. After looking at the material in the material editor it updates on the static - but not before I do that.
Any ideas?
Cheers,
Andy
Torque Owner Alfio Saitta
Collateral Studios
or: