Andy Gilbert Posted November 30, 2009 Share Posted November 30, 2009 Trying to check for key inputs in lua but struggling. I tried : if KeyDown(KEY_SPACE)==1 then model1body:AddForce(Vec3(0,0,100)) end Which didnt work, so i then tried : if KeyDown(KEY_SPACE)==1 then AppTerminate=1 end Which also does nothing.... thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Rick Posted November 30, 2009 Share Posted November 30, 2009 Trying to check for key inputs in lua but struggling. I tried : if KeyDown(KEY_SPACE)==1 then model1body:AddForce(Vec3(0,0,100)) end Which didnt work, so i then tried : if KeyDown(KEY_SPACE)==1 then AppTerminate=1 end Which also does nothing.... thanks Andy Are you including dofile('\Scripts\base.lua') to your script at the top? I think it's required for the key constants. Try KeyHit() also. Just to make sure. Also put an AppLog() inside your if statement and check your engine log to make sure it's getting inside there. Quote Link to comment Share on other sites More sharing options...
Canardia Posted November 30, 2009 Share Posted November 30, 2009 It should work, you should use AppLog("KEY SPACE DOWN") to see if it has any effect. Keypressed work only if you click on the Editor scene first, I click on the terrain so I don't select any objects. 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...
Josh Posted November 30, 2009 Share Posted November 30, 2009 AppTerminate is a variable you are initializing in the loop. It would not have any effect. Try Notify("Hit!"). Make sure you are including the keycodes script that defines all the key constants. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Andy Gilbert Posted November 30, 2009 Author Share Posted November 30, 2009 Yea your right, need the scripts/base.lua in there. Thanks Andy Quote The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d 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.