Category | Scripting |
Created | 01.11.2017 14:14 |
Bricktop Jr (Bricktop) | 01.11.2017 14:14 |
---|---|
How can i stop the vehicle camera rotation at all? I need it while InputBinding.setShowMouseCursor(true)... Greets |
Bricktop Jr (Bricktop) | 05.11.2017 06:18 |
---|---|
mb. something similar like. “self.cameras.[CAM].allowTranslation“ ,just for rotation? any? cheerio .. |
Bricktop Jr (Bricktop) | 07.11.2017 23:41 |
---|---|
to use on the vehicle... stop camera rotation and mousewheel translation for each vehicle camera (no prevention for jump out with E button): --#define some var in (load) function: self.URE_GLOBAL_GUI_BOOL = false; --(set it true or false, mb with "InputBinding.hasEvent") self.URE_GLOBAL_GUI_ARRAY = {}; self.URE_GLOBAL_GUI_ARRAY.rotation = {}; self.URE_GLOBAL_GUI_ARRAY.translation = {}; --#in (update) function (or create a function and call from update) use: if not self.URE_GLOBAL_GUI_BOOL_VARIABLE then InputBinding.setShowMouseCursor(true); self.URE_GLOBAL_GUI_BOOL_VARIABLE = true; for i, cam in pairs(self.cameras) do if cam.isRotatable ~= nil and cam.isRotatable then self.URE_GLOBAL_GUI_ARRAY.rotation[i] = true; cam.isRotatable = false; end; if cam.allowTranslation ~= nil and cam.allowTranslation then self.URE_GLOBAL_GUI_ARRAY.translation[i] = true; cam.allowTranslation = false; end; end; else InputBinding.setShowMouseCursor(false); self.URE_GLOBAL_GUI_BOOL_VARIABLE = false; for i, cam in pairs(self.cameras) do if self.URE_GLOBAL_GUI_ARRAY.rotation[i] then cam.isRotatable = true; self.URE_GLOBAL_GUI_ARRAY.rotation[i] = nil; end; if self.URE_GLOBAL_GUI_ARRAY.translation[i] then cam.allowTranslation = true; self.URE_GLOBAL_GUI_ARRAY.translation[i] = nil; end; end; end; stop camera rotation and mousewheel translation for the current used vehicle camera: (prevention to switch to another camera) (close gui and unfrezze player when hit the E button) (ESC button works with "Pause-menu" but no switch to other vehicles) --#define some var in (load) function: self.MYMOD.BOOL = false; --(GUI on/off) self.MYMOD.STORE = {}; --(array to store cam data) --#in (update) function use: if InputBinding.hasEvent(InputBinding.MYMOD_OPEN_CLOSE_GUI) then if not self.MYMOD.BOOL then self.MYMOD.BOOL, self.MYMOD.STORE = MYMOD:GUIOnOff(true, self.cameras, self.MYMOD.STORE, self.MYMOD.BOOL); else self.MYMOD.BOOL, self.MYMOD.STORE = MYMOD:GUIOnOff(false, self.cameras, self.MYMOD.STORE, self.MYMOD.BOOL); end; end; if not self.isEntered or not self.isControlled or self ~= g_currentMission.controlledVehicle then self.MYMOD.BOOL, self.MYMOD.STORE = MYMOD:GUIOnOff(false, self.cameras, self.MYMOD.STORE, self.MYMOD.BOOL); end; --#a function: function MYMOD:GUIOnOff(state, cams, store, guiActive) if state then g_currentMission.isPlayerFrozen = true; InputBinding.setShowMouseCursor(true); guiActive = true; for i, cam in pairs(cams) do if cam.isActivated then store[1] = i; if cam.isRotatable then store[2] = cam.isRotatable; cam.isRotatable = false; end; if cam.allowTranslation then store[3] = cam.allowTranslation; cam.allowTranslation = false; end; break; end; end; return guiActive, store; else if store[1] then if store[2] then cams[store[1]].isRotatable = store[2]; end; if store[3] then cams[store[1]].allowTranslation = store[3]; end; end; g_currentMission.isPlayerFrozen = false; InputBinding.setShowMouseCursor(false); guiActive = false; return guiActive, {}; end; end; |
Bricktop Jr (Bricktop) | 07.11.2017 23:50 |
---|---|
to use on the vehicle... stop camera rotation and mousewheel translation for each vehicle camera (no prevention for jump out with E button): --#define some var in (load) function: self.URE_GLOBAL_GUI_BOOL = false; --(set it true or false, mb with "InputBinding.hasEvent") self.URE_GLOBAL_GUI_ARRAY = {}; self.URE_GLOBAL_GUI_ARRAY.rotation = {}; self.URE_GLOBAL_GUI_ARRAY.translation = {}; --#in (update) function (or create a function and call from update) use: if not self.URE_GLOBAL_GUI_BOOL_VARIABLE then InputBinding.setShowMouseCursor(true); self.URE_GLOBAL_GUI_BOOL_VARIABLE = true; for i, cam in pairs(self.cameras) do if cam.isRotatable ~= nil and cam.isRotatable then self.URE_GLOBAL_GUI_ARRAY.rotation[i] = true; cam.isRotatable = false; end; if cam.allowTranslation ~= nil and cam.allowTranslation then self.URE_GLOBAL_GUI_ARRAY.translation[i] = true; cam.allowTranslation = false; end; end; else InputBinding.setShowMouseCursor(false); self.URE_GLOBAL_GUI_BOOL_VARIABLE = false; for i, cam in pairs(self.cameras) do if self.URE_GLOBAL_GUI_ARRAY.rotation[i] then cam.isRotatable = true; self.URE_GLOBAL_GUI_ARRAY.rotation[i] = nil; end; if self.URE_GLOBAL_GUI_ARRAY.translation[i] then cam.allowTranslation = true; self.URE_GLOBAL_GUI_ARRAY.translation[i] = nil; end; end; end; stop camera rotation and mousewheel translation for the current used vehicle camera: (prevention to switch to another camera) (close gui and unfrezze player when hit the E button) (ESC button works with "Pause-menu" but no switch to other vehicles) --#define some var in (load) function: self.MYMOD.BOOL = false; --(GUI on/off) self.MYMOD.STORE = {}; --(array to store cam data) --#in (update) function use: if InputBinding.hasEvent(InputBinding.MYMOD_OPEN_CLOSE_GUI) then if not self.MYMOD.BOOL then self.MYMOD.BOOL, self.MYMOD.STORE = MYMOD:GUIOnOff(true, self.cameras, self.MYMOD.STORE, self.MYMOD.BOOL); else self.MYMOD.BOOL, self.MYMOD.STORE = MYMOD:GUIOnOff(false, self.cameras, self.MYMOD.STORE, self.MYMOD.BOOL); end; end; if not self.isEntered or not vehicle.isControlled or self ~= g_currentMission.controlledVehicle then self.MYMOD.BOOL, self.MYMOD.STORE = MYMOD:GUIOnOff(false, self.cameras, self.MYMOD.STORE, self.MYMOD.BOOL); end; --#a function: function MYMOD:GUIOnOff(state, cams, store, guiActive) if state then g_currentMission.isPlayerFrozen = true; InputBinding.setShowMouseCursor(true); guiActive = true; for i, cam in pairs(cams) do if cam.isActivated then store[1] = i; if cam.isRotatable then store[2] = cam.isRotatable; cam.isRotatable = false; end; if cam.allowTranslation then store[3] = cam.allowTranslation; cam.allowTranslation = false; end; break; end; end; return guiActive, store; else if store[1] then if store[2] then cams[store[1]].isRotatable = store[2]; end; if store[3] then cams[store[1]].allowTranslation = store[3]; end; end; g_currentMission.isPlayerFrozen = false; InputBinding.setShowMouseCursor(false); guiActive = false; return guiActive, {}; end; end; |
Note: Log in to post. Create a new account here.