gordonramp Posted November 25, 2009 Posted November 25, 2009 Great to be exploring the new editor. I need something clarified. When I make a scene which is saved as a .sbx file, how do I run that outside the editor? Can I run it with the Lua Engine? I found the spinning cube in Lua but is there any example Lua code to run a .sbx scene. Quote AMD Athlon x2 7750 2.7ghz, 6gb ddr2 ram, Galaxy9800GT 1gig ddr2 video card, Windows 7,64.
Josh Posted November 25, 2009 Posted November 25, 2009 LoadScene(), just like in C++. Quote My job is to make tools you love, with the features you want, and performance you can't live without.
gordonramp Posted November 25, 2009 Author Posted November 25, 2009 Mmm, so there is no Lua example of how to run a scene which has been exported from the Editor No offense but I find that rather strange. Quote AMD Athlon x2 7750 2.7ghz, 6gb ddr2 ram, Galaxy9800GT 1gig ddr2 video card, Windows 7,64.
Guest Red Ocktober Posted November 25, 2009 Posted November 25, 2009 hey G... in the root directory there are two example scripts that can be loaded and run from the script editor... also... here's a quick and dirty example that worked for a scene i did in the editor... give it a try... substitue your scene path and set the camera so you can see the scene (or spin it)... --Register abstract path RegisterAbstractPath("") --Set graphics mode if Graphics(1024,768)==0 then Notify("Failed to set graphics mode.",1) return end world=CreateWorld() if world==nil then Notify("Failed to initialize engine.",1) return end gbuffer=CreateBuffer(GraphicsWidth(),GraphicsHeight(),1+2+4+8) camera=CreateCamera() camera:SetPosition(Vec3(4,1,-10)) camera:Turnf(0.0,42,0.0) scene=LoadScene("abstract::myfirst230.sbx") while AppTerminate()==0 do --camera:Turnf(0,AppSpeed()/12,0) UpdateAppTime() world:Update(AppSpeed()) SetBuffer(gbuffer) world:Render() SetBuffer(BackBuffer()) world:RenderLights(gbuffer) DrawText(UPS(),0,0) Flip(0) end good luck... --Mike Quote
Canardia Posted November 25, 2009 Posted November 25, 2009 Theoretically when you add this code block to the fpscontroller.lua, after the line fw=GetGlobalObject("framewerk"), it should make it runnable from outside Editor, but for some reason it crashes. Maybe Josh could check why?: if fw==nil then --Register abstract path RegisterAbstractPath("") --Set graphics mode if Graphics(1024,768)==0 then Notify("Failed to set graphics mode.",1) return end --Create framewerk object and set it to a global object so other scripts can access it fw=CreateFramewerk() if fw==nil then Notify("Failed to initialize engine.",1) return end SetGlobalObject("framewerk",fw) fw.main.camera.position.y=20 scene=LoadScene("abstract::tunnels.sbx") end If you change it to load train.sbx, then it doesn't crash, but the player doesn't collide with the terrain. I tried scene:SetType(1), but there is no such command. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■
gordonramp Posted November 25, 2009 Author Posted November 25, 2009 Hi Red.. That code partialy works,no skybox turns up..I also adapted the spinning cube by just adding the LoadScene() command, that also worked, but again no atmospherics. Lumooga.. That's what is needed, a first person example (with and without a gun) that runs in Lua outside the Editor. Quote AMD Athlon x2 7750 2.7ghz, 6gb ddr2 ram, Galaxy9800GT 1gig ddr2 video card, Windows 7,64.
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.