webhead Posted June 20, 2011 Share Posted June 20, 2011 hello im new to this programming stuff ,can anyone point me in the direction of lots of basic tutorials for me to try please. engine looks great,seems pretty easy but then im only mucking around at the moment , need to learn something so can you help thanks. and hello to all.. Quote Link to comment Share on other sites More sharing options...
Roland Posted June 20, 2011 Share Posted June 20, 2011 There are some very nice Lua tutorials by Aggror here http://www.leadwerks.com/werkspace/page/Documentation/LE2/tutorials/_/programming/lua/ Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Richard Simpson Posted June 20, 2011 Share Posted June 20, 2011 And a main link to the rest of the tutorials. http://www.leadwerks.com/werkspace/page/documentation Quote Intel core 2 quad 6600 | Nvidia Geforce GTX460 1GB | 2GB DDR2 Ram | Windows 7. Google Sketchup | Photoshop | Blender | UU3D | Leadwerks Engine 2.4 Link to comment Share on other sites More sharing options...
VeTaL Posted June 20, 2011 Share Posted June 20, 2011 Continuing tutorials theme: http://www.leadwerks.com/werkspace/page/Documentation/LE2/tutorials/_/artwork/tools/ Quote Working on LeaFAQ Link to comment Share on other sites More sharing options...
LandsHeer Posted July 4, 2011 Share Posted July 4, 2011 Hey guys, I think this is the right Thread so I dont have to create a new one ^^ I started on the lua tutorials here and stuck at the Lightning section. I wrote it exactly like it is in there but the script editor is giving me following error: attempt to index global 'cube' (a nil value) anyway, here is the code I have in the script editor: -- Register the abstract path RegisterAbstractPath("") --Set a graphics mode Graphics(800,600) --Create a framework object fw = CreateFramework() --set the camera camera = fw.main.camera camera:SetPosition(Vec3(0,2,-10)) --Create a cube cube: CreateCube() cube: SetPosition(Vec3(0,1,0)) cube: SetScale(Vec3(2,2,2)) --Create ground cube:CreateCube() cube:SetPosition(Vec3(0,-2,0)) cube:SetScale(Vec3(20,1,20)) --Create a light light=CreateSpotLight(8) light:SetPosition(Vec3(0,3,0)) DebugLights (1) -- Create the main loop while AppTerminate() == 0 do -- Rotate the cube every frame by 0.1 in every direction cube:Turn(Vec3(0.1,0.1,0.1)) fw:Render() fw:Render() Flip(0) end Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 4, 2011 Share Posted July 4, 2011 should be: cube = CreateCube() call the ground a different variable or it will rotate the ground in the main loop. also, the main loop should have one 'fw:Update()' and one 'fw:Render()', not two 'fw:Render()'. 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...
LandsHeer Posted July 4, 2011 Share Posted July 4, 2011 Ah ok yea i thought so about the two Render(). Then the tutorial has some small mistakes in it heh Quote Link to comment Share on other sites More sharing options...
LandsHeer Posted July 5, 2011 Share Posted July 5, 2011 Hey guys, got another problem with one of the lua tutorials, I went through the Camera Control tutorial and wrote the code in the script editor exactly like it is in the pdf. When I run the code now, the camera does rotate like crazy, but I dont know what the problem could be... hope someone can help me here: --Include the engine_const.lua file for keyboard input require("Scripts/constants/engine_const") --registering the abstract path RegisterAbstractPath("") --Set a graphics mode Graphics(800,600) --Framework object fw = CreateFramework() --Set camera camera = fw.main.camera camera:SetPosition(Vec3(0,1,-5)) --Create directionallight light1 = CreateDirectionalLight() light1:SetRotation(Vec3(45,45,0)) --Load a mesh scene = LoadMesh("abstract::scene.gmf") if scene == nil then Notify("Failed to load scene.gmf") end --Move the mouse to the center of the screen and hide it MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2) HideMouse(1) camrotation=Vec3(0) --Main loop while KeyDown(KEY_ESCAPE)==0 do --Camera rotation gx=Curve(MouseX() - GraphicsWidth() /2, gx, 10) gx=Curve(MouseX() - GraphicsWidth() /2, gx, 10) gy=Curve(MouseY() - GraphicsHeight() /2, gy, 10) camrotation.x = camrotation.x + gy / 10 camrotation.y = camrotation.y - gx / 10 camera:SetRotation(camrotation,1) --Camera movement move = Curve(KeyDown(KEY_W) - KeyDown(KEY_S), move, 10) strafe = Curve(KeyDown(KEY_D) - KeyDown(KEY_A), strafe, 10) camera:Move(Vec3(move/10, 0, strafe/10)) fw:Update() fw:Render() Flip(0) end Quote Link to comment Share on other sites More sharing options...
Canardia Posted July 5, 2011 Share Posted July 5, 2011 These lines look at bit wierd: gx=Curve(MouseX() - GraphicsWidth() /2, gx, 10) gx=Curve(MouseX() - GraphicsWidth() /2, gx, 10) gy=Curve(MouseY() - GraphicsHeight() /2, gy, 10) It should be: gx=Curve(MouseX() - GraphicsWidth ()/2, gx, 10) gy=Curve(MouseY() - GraphicsHeight()/2, gy, 10) 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...
LandsHeer Posted July 5, 2011 Share Posted July 5, 2011 thx for your help metatron, but when i run the script the mouse look is very very very sensitive, so when that the mouse goes crazy like hell and everything is rotating very fast. So its impossible for me to see anything. Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 5, 2011 Share Posted July 5, 2011 try this: require("Scripts/constants/engine_const") require("Scripts/math/math") RegisterAbstractPath("") Graphics(800,600) fw = CreateFramework() fw.main.camera:SetPosition(Vec3(0,1,-5)) light1 = CreateDirectionalLight() light1:SetRotation(Vec3(45,45,0)) scene = LoadMesh("abstract::scene.gmf") gx=Round(GraphicsWidth()/2) gy=Round(GraphicsHeight()/2) MoveMouse(gx,gy) camerapitch=fw.main.camera.rotation.x camerayaw=fw.main.camera.rotation.y HideMouse(1) while KeyDown(KEY_ESCAPE)==0 do dx=Curve((MouseX()-gx)/4.0,dx,3.0/AppSpeed()) dy=Curve((MouseY()-gy)/4.0,dy,3.0/AppSpeed()) MoveMouse(gx,gy) camerapitch=camerapitch+dy camerayaw=camerayaw-dx fw.main.camera:SetRotationf(camerapitch,camerayaw,0) move = Curve(KeyDown(KEY_W) - KeyDown(KEY_S), move, 10) strafe = Curve(KeyDown(KEY_D) - KeyDown(KEY_A), strafe, 10) fw.main.camera:Move(Vec3(strafe/10, 0, move/10)) fw:Update() fw:Render() Flip(1) 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...
LandsHeer Posted July 6, 2011 Share Posted July 6, 2011 cheers macklebee, that works a lot better now Quote Link to comment Share on other sites More sharing options...
Canardia Posted July 6, 2011 Share Posted July 6, 2011 I think 3.0/AppSpeed() is wrong, because it will amplify lag differences, so slow things get slower, and fast things get faster when the FPS changes. I should be: 3.0*AppSpeed(), or just plain 8.0. 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...
LandsHeer Posted July 6, 2011 Share Posted July 6, 2011 ok thx I will try that out Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 6, 2011 Share Posted July 6, 2011 Actually by multiplying you are reducing the number of increments between the new value parameter and the old value parameter depending on if vsynch is turned on or not. With vsych on, i get roughly about 1 for AppSpeed. With it off, I get ~0.2. So with vsynch off, you get a choppy rotation which is why i used division so it would always be at least 3 increments. This might just be a poor place to use it but it was pulled from one of the SDK's inherent scripts. Granted that could be resolved by simply just using a value that has nothing to do with AppSpeed. But as megatron said and according to the wiki, movement should be multiplied by appspeed but in this case it might make sense to have more increments at a higher frame rate. 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.