Skip to main content

Camera

Camera provides small runtime queries and field-of-view changes without replacing Camera Rig or Camera Zone authoring.

MethodReturnsDescription
Camera.Has(gameObjectId)booleanChecks for a Camera component.
Camera.GetActive()integerReturns the active Camera GameObject, or -1.
Camera.GetFieldOfView(gameObjectId)number or nilReads vertical FOV.
Camera.SetFieldOfView(gameObjectId, degrees)booleanSets a validated vertical FOV.
cameraGameObjectId = -1
normalFieldOfView = 60.0
focusFieldOfView = 48.0

function Start(gameObjectId)
if cameraGameObjectId < 0 then
cameraGameObjectId = Camera.GetActive()
end
end

function Update(gameObjectId, deltaTime)
if Camera.Has(cameraGameObjectId) then
local target = Input.GetButton("Focus") and focusFieldOfView or normalFieldOfView
Camera.SetFieldOfView(cameraGameObjectId, target)
end
end

Use the Camera GameObject's Transform for scripted position or rotation. Verify camera changes in the packaged build because editor and PS1 projection paths are not pixel-identical.

Before using the example, add a Focus Button action in Project Settings > Input Action Map and choose its physical binding. Focus is an example action, not an automatically available project default.