omid3098 Posted May 6, 2013 Share Posted May 6, 2013 Hi. I am trying to control camera FOV using two keys in Lua (to increase and decrese) but I cant access to main Camera FOV. I have a CameraManager node in the scene and the code is something like this: require("Scripts/class") require("Scripts/constants/keycodes") require("Scripts/hooks") local class=CreateClass(...) function class:CreateObject(model) function object:DHook() if KeyDown(KEY_U)==1 then CameraZoom(45.0) -- or what? how should I use CameraZoom? end end AddHook("Flip" , object.DHook ) function object:Free() RemoveHook("Flip" , object.DHook ) self.super:Free() end end there were CameraZoom(cam,value) in the forum but I dont know what is cam or how I can create that to use Camera zoom. actually tried cam=fw.main.camera but that is for framework I think. I did not write other parts of this code and also I don't have access to our programmer. and I'm not dump thanks before Quote Omid Saadat OD Arts Blog AMD Phenom II X4 940 - Geforce 8800GTS - 4GB RAM - XP x86 AMD 6000+ - Geforce 9800 GT - 2GB RAM - XP x86 (Home pc) Intel Core i7 - Geforce 310M - 4GB Ram - Win7 x64 (Laptop) Link to comment Share on other sites More sharing options...
Josh Posted May 6, 2013 Share Posted May 6, 2013 I'm assuming you guys are using the framework class: http://www.leadwerks.com/werkspace/page/Documentation/le2/_/command-reference/framework/getlayercamera-r222 http://www.leadwerks.com/werkspace/page/Documentation/le2/_/command-reference/framework/getframeworklayer-r221 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...
omid3098 Posted May 6, 2013 Author Share Posted May 6, 2013 (edited) Ok. I'm a dump. would you please describe more? CameraZoom is only for C and C++ and there is nothing for LUA. I just have to open Editor and edit some LUA codes to play with camera and do some trailer. Edit: this code gives "Malformed number near 0.5f" error. CameraZoom(camera, 0.5f) Edited May 6, 2013 by omid3098 Quote Omid Saadat OD Arts Blog AMD Phenom II X4 940 - Geforce 8800GTS - 4GB RAM - XP x86 AMD 6000+ - Geforce 9800 GT - 2GB RAM - XP x86 (Home pc) Intel Core i7 - Geforce 310M - 4GB Ram - Win7 x64 (Laptop) Link to comment Share on other sites More sharing options...
Josh Posted May 6, 2013 Share Posted May 6, 2013 You do not need to include the 'f' in the float value. 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...
omid3098 Posted May 6, 2013 Author Share Posted May 6, 2013 it says value at index (1) is not an object Quote Omid Saadat OD Arts Blog AMD Phenom II X4 940 - Geforce 8800GTS - 4GB RAM - XP x86 AMD 6000+ - Geforce 9800 GT - 2GB RAM - XP x86 (Home pc) Intel Core i7 - Geforce 310M - 4GB Ram - Win7 x64 (Laptop) Link to comment Share on other sites More sharing options...
Josh Posted May 6, 2013 Share Posted May 6, 2013 Your programmer is going to have to do this. I can't debug a program with one line of code. 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...
omid3098 Posted May 7, 2013 Author Share Posted May 7, 2013 Programmer is doing bugfix since more than 2 months and I don't have permission to access him. this is my CameraManager.lua: require("Scripts/class") require("Scripts/constants/keycodes") require("Scripts/hooks") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) --object.cameraFOV = CameraZoom(camera,1.0) SetFarDOFRange(2,5) SetFarDOFStrength(1) SetFarDOF(1) function object:DHook() -- Test if keys are working if KeyDown(KEY_U)==1 then SetFarDOF(1) end if KeyDown(KEY_Y)==1 then SetFarDOF(0) end end AddHook("Flip" , object.DHook ) function object:Free() RemoveHook("Flip" , object.DHook ) self.super:Free() end end I can enable/Disable DOF with keys but I have no Ideas how to access camera FOV. Quote Omid Saadat OD Arts Blog AMD Phenom II X4 940 - Geforce 8800GTS - 4GB RAM - XP x86 AMD 6000+ - Geforce 9800 GT - 2GB RAM - XP x86 (Home pc) Intel Core i7 - Geforce 310M - 4GB Ram - Win7 x64 (Laptop) Link to comment Share on other sites More sharing options...
omid3098 Posted May 7, 2013 Author Share Posted May 7, 2013 now it works using this code: require("Scripts/class") require("Scripts/constants/keycodes") require("Scripts/hooks") local class=CreateClass(...) function class:CreateObject(model) local object=self.super:CreateObject(model) function object:Update() if KeyDown(KEY_UP)==1 then CameraZoom(fw.main.camera,0.5) end if KeyDown(KEY_DOWN)==1 then CameraZoom(fw.main.camera,1.0) end end function object:Free() self.super:Free() end end 1 Quote Omid Saadat OD Arts Blog AMD Phenom II X4 940 - Geforce 8800GTS - 4GB RAM - XP x86 AMD 6000+ - Geforce 9800 GT - 2GB RAM - XP x86 (Home pc) Intel Core i7 - Geforce 310M - 4GB Ram - Win7 x64 (Laptop) 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.