I have a radio tower model and created this script that creates a red Corona and places it on top of the mast. This works fine in the editor.
But the Corona never shows in a compiled BMax program. No errors are reported in the log and the materials are loaded.
Using Macklebee's controller.bmx code as a barebones test program it still won't show. Typically this sort of problem is due to missing assets from the app directory tree but the logs from both the LE Editor and my compiled programs clearly show it loading the script and assets (and I tested the controller and testscene from the same fold as the editor).
Is there anything obviously wrong with this code?
dofile("Scripts/base.lua")
local antennalight
function Spawn(model)
local entity=base_Spawn(model)
antennalight = CreateCorona(model)
antennalight:Paint(LoadMaterial("abstract::flare1.mat"),1)
antennalight:SetParent(model,0)
antennalight:SetPosition(Vec3(0,model.aabb.h+0.1,0),0)
antennalight:SetColor(Vec4(1.0,0,0,1),0)
SetCoronaRadius(antennalight,2,2)
base_SetKey("collisiontype",COLLISION_PROP)
return entity
end
function Kill(model)
if antennalight~=nil then
antennalight:Free()
end
end
If I can get models to spawn coronas and light sources it will make lighting night scenes much easier.
environment _atmosphere objects should work also but I had to process that in a SceneLoader to get fog and camera distance to work. I'm wondering if Corona's are another special case?