GE Lua Documentation

Press F to search!

setGlobalCameraByName

Definition


-- @/lua/ge/extensions/core/camera.lua:243

local function setGlobalCameraByName(name, withTransition, customData)
  if not name and not getPlayerVehicle(0) then return end
  local newCam = getGlobalCameras()[name]
  if name and not newCam then return end

  -- process old cam
  local oldCam = getGlobalCameras()[activeGlobalCameraName]
  if oldCam and type(oldCam.onCameraChanged) == 'function' then oldCam:onCameraChanged(false) end

  -- process new cam
  activeGlobalCameraName = name
  if newCam then
    if newCam.setCustomData then newCam:setCustomData(customData or {}) end
    if type(newCam.onCameraChanged) == 'function' then newCam:onCameraChanged(true) end
  end

  extensions.hook("onGlobalCameraSet", name)
end

Callers

@/lua/ge/extensions/core/camera.lua
  if activeGlobalCameraName then
    setGlobalCameraByName(nil)
  end
  if activeGlobalCameraName then
    setGlobalCameraByName(nil)
  end
  else
    setGlobalCameraByName(camName, withTransition, customData)
  end
      if activeGlobalCameraName then
        setGlobalCameraByName(nil)
      end
    else
      setGlobalCameraByName(nil)
    end
  if activeGlobalCameraName then
    setGlobalCameraByName(nil)
    displayCameraNameUI(player)
  if trigger.event == 'exit' and trigger.cameraOnLeave == true then
    setGlobalCameraByName(nil)
    local vdata = getVehicleData()[vid]
    if cam then
      setGlobalCameraByName("observer", nil, {cam = cam, targetOverride = triggerTargetOverride or cam.targetOverride})
    else
M.setVehicleCameraByNameWithId = setVehicleCameraByNameWithId
M.exitCinematicCamera = function() setGlobalCameraByName(nil) end -- retrocompatibility layer
M.toggleEnabledById = toggleEnabledCameraById
@/lua/ge/extensions/career/modules/vehiclePerformance.lua
      spawn.safeTeleport(getPlayerVehicle(0), playerInitialPos)
      core_camera.setGlobalCameraByName(nil)
      onPerformanceTestStarted(false)
@/lua/ge/server/commands.lua
  core_camera.requestConfig(nil)
  core_camera.setGlobalCameraByName(nil)
  return cam
local function setGameCamera()
  core_camera.setGlobalCameraByName(nil)
end