Flexman Posted December 6, 2009 Share Posted December 6, 2009 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? Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
macklebee Posted December 6, 2009 Share Posted December 6, 2009 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? Yes, until Josh shows us otherwise, then the distancefog and camera distance appear to have be loaded by parsing like I did in my program. But if you look at my screenshot for my program, I have a corona. I didn't have to do anything special in the code to just get it to work. If you add a corona to your test scene, and load it with the example program you will get the corona as well. So this leads me to believe that is something wrong with your code above... I will try playing around with it... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
macklebee Posted December 6, 2009 Share Posted December 6, 2009 eh... ive got it to work... now i just got to figure out why it works compared to your code... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
macklebee Posted December 6, 2009 Share Posted December 6, 2009 the problem is this line: antennalight:SetPosition(Vec3(0,model.aabb.h+0.1,0),0) if you replace model.aabb.h with an actual number, the corona will show up. So my guess is that you would need to somehow set this variable as a global value between bmax and lua... Or just do it the easy way and set it to a numerical value... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Flexman Posted December 7, 2009 Author Share Posted December 7, 2009 Aha, yes. To confirm, that works now. Serves me right for trying to be cleaver. It's no hardship to set it to a fixed size. I'm guessing the AABB isn't updated until a scene update which occurs in the editor environment but not when it's loading for the first time in a compiled app. That's a beer I owe you. Cheers. Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
macklebee Posted December 7, 2009 Share Posted December 7, 2009 no problem, glad i could help... you might want to use this program instead of the controller.bmx program... it allows skybox and water to be set based on your map created by the editor and set hdr, bloom, ssao, etc during runtime... there's nothing special about it, you just get a little more out of it than the controller.bmx.. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.