Guest Red Ocktober Posted February 26, 2010 Share Posted February 26, 2010 i can't even get the camera to move... i mean, this should be a straight forward deal... in blitmax the simplest way is... While Not KeyHit(KEY_ESCAPE) If KeyDown(KEY_A) turnEntity fw.Main.camera,Vec3(0,1,0) If KeyDown(KEY_D) turnEntity fw.Main.camera,Vec3(0,-1,0) If KeyDown(KEY_W) moveEntity fw.Main.camera,Vec3(0,0,.1) If KeyDown(KEY_Q) moveEntity fw.Main.camera,Vec3(0,.1,0) If KeyDown(KEY_Z) moveEntity fw.Main.camera,Vec3(0,-.1,0) fw.Update() fw.Render() Flip(0) Wend this is what i'm trying in lua... while AppTerminate()==0 do if KeyDown (KEY_D)==1 then TurnEntity (camera, Vec3(0,-.1,0)) end if KeyDown (KEY_W)==1 then MoveEntity (camera, Vec3(0,0,1)) end if KeyDown (KEY_Q)==1 then MoveEntity (camera, Vec3(0,.1,0)) end if KeyDown (KEY_Z)==1 then MoveEntity (camera, Vec3(0,-.1,0)) end fw:Update() fw:Render() Flip(0) end can someone please smack me in the head and put me on the right track... thx --Mike Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 26, 2010 Share Posted February 26, 2010 is camera = fw.main.camera? 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...
Guest Red Ocktober Posted February 26, 2010 Share Posted February 26, 2010 yes... yes it is... --Mike Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 26, 2010 Share Posted February 26, 2010 do you have this in your script? require("scripts/constants/engine_const") 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...
Guest Red Ocktober Posted February 26, 2010 Share Posted February 26, 2010 no i don't... trying it now... where's all this lua info at mack? --Mike Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 26, 2010 Share Posted February 26, 2010 Theres the Getting Started with Lua pdf file thats located on the homepage's tutorial page, and there are the example scripts that come with LE. Those are the best sources of info to learn how to use LE's lua implementation. 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...
Guest Red Ocktober Posted February 26, 2010 Share Posted February 26, 2010 thx Mac... although i had that page open, i glanced right past that requires statement ( that seemed to work, but: 1- my framerate shot right down to 2 fps 2- the example doesn't use require(scripts/constants/engine_const"), but instead uses require("scripts/constants/keycodes")... i tried both, and both seem to work... do u know what the functional difference is off the top of your head... i'm going to look at both the scripts in a few minutes... where would i be without you and MG... thx again... --Mike Quote Link to comment Share on other sites More sharing options...
macklebee Posted February 26, 2010 Share Posted February 26, 2010 1) where are you trying to do this at? in a standalone script or in a game script inside the Editor? 2) both have the keycode information, but engine_const has more info for buffers, entities, etc... try this code outside of the editor, by opening up the ScriptEditor located in the SDK directory and press play. works just fine for me... require("scripts/constants/engine_const") --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=CreateFramework() if fw==nil then Notify("Failed to initialize engine.",1) return end fw.main.camera:SetPositionf(0,0,-2) light=CreateSpotLight(10) light:SetRotationf(45,55,0) light:SetPositionf(5,5,-5) material=LoadMaterial("abstract::cobblestones.mat") mesh=CreateCube() mesh:Paint(material) ground=CreateCube() ground:SetScalef(10.0,1.0,10.0) ground:SetPositionf(0.0,-2.0,0.0) ground:Paint(material) light=CreateDirectionalLight() light:SetRotationf(45,45,45) while AppTerminate()==0 do mesh:Turnf(AppSpeed()*0.5,AppSpeed()*0.5,AppSpeed()*0.5) if KeyDown (KEY_D)==1 then TurnEntity (fw.main.camera, Vec3(0,-.1,0)) end if KeyDown (KEY_A)==1 then TurnEntity (fw.main.camera, Vec3(0,.1,0)) end if KeyDown (KEY_W)==1 then MoveEntity (fw.main.camera, Vec3(0,0,.1)) end if KeyDown (KEY_S)==1 then MoveEntity (fw.main.camera, Vec3(0,0,-.1)) end if KeyDown (KEY_Q)==1 then MoveEntity (fw.main.camera, Vec3(0,.1,0)) end if KeyDown (KEY_Z)==1 then MoveEntity (fw.main.camera, Vec3(0,-.1,0)) end fw:Update() fw:Render() Flip(0) end 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...
Guest Red Ocktober Posted February 26, 2010 Share Posted February 26, 2010 1- running from the script ed... running standalone lua things are much better... 2- k, makes sense i should us the one with the most stuff declared... josh should put you on the payroll... --Mike Quote 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.