gordonramp Posted December 28, 2009 Share Posted December 28, 2009 I've been trying to get mouselook and mousemovment working with the following piece of Lua code. It loads a scene outside of the Leadwerks Editor using the Lua Engine. require("Scripts/constants/keycodes")require("Scripts/constants/collision_const") require("Scripts/constants/engine_const") require("Scripts/LinkedList") require("Scripts/filesystem") require("Scripts/math/math") --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(37,1,-14)) scene=LoadScene("abstract::train.sbx") while AppTerminate()==0 do UpdateAppTime() world:Update(AppSpeed()) SetBuffer(gbuffer) world:Render() SetBuffer(BackBuffer()) world:RenderLights(gbuffer) if KeyHit(KEY_ESCAPE)==1 then break end if KeyHit(KEY_T)==1 then camera:SetPosition(Vec3(30,1,-14)) end DrawText(UPS(),0,0) Flip(0) end As soon as I add a controller I get the errors occur.. require("Scripts/constants/keycodes")require("Scripts/constants/collision_const") require("Scripts/constants/engine_const") require("Scripts/LinkedList") require("Scripts/filesystem") require("Scripts/math/math") --Variables dx=0.0 dy=0.0 camerapitch=0.0 camerayaw=0.0 move=0.0 strafe=0.0 --Create a player controller controller=CreateController(1.8,0.45,0.25,45) controller:SetCollisionType(COLLISION_CHARACTER,0) controller:SetPositionf(0,2,0,0) controller:SetMass(10) --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(37,1,-14)) scene=LoadScene("abstract::train.sbx") while AppTerminate()==0 do UpdateAppTime() world:Update(AppSpeed()) SetBuffer(gbuffer) world:Render() SetBuffer(BackBuffer()) world:RenderLights(gbuffer) if KeyHit(KEY_ESCAPE)==1 then break end if KeyHit(KEY_T)==1 then camera:SetPosition(Vec3(30,1,-14)) end DrawText(UPS(),0,0) Flip(0) end I know there is more code to add in the loop. But it doesn't even like the variables. Quote AMD Athlon x2 7750 2.7ghz, 6gb ddr2 ram, Galaxy9800GT 1gig ddr2 video card, Windows 7,64. Link to comment Share on other sites More sharing options...
Canardia Posted December 28, 2009 Share Posted December 28, 2009 Ugh, you should use framework in first place. It's horrible to read code which uses custom buffers and renderlights and stuff 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 ■ Link to comment Share on other sites More sharing options...
macklebee Posted December 28, 2009 Share Posted December 28, 2009 Ugh, you should use framework in first place. It's horrible to read code which uses custom buffers and renderlights and stuff it looks like Josh removed framewerk from lua? if you run the example02.lua it fails at "CreateFramewerk()"... which is what AndyGFX was trying to point out in his post but I wasn't understanding that he was just referring to lua... 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.