SetFOV

This function sets a camera's field of view (FOV). The field of view is an angle that controls how broad the visible region is on the vertical axis.

The default camera FOV is 90.0.

Syntax

Parameters

Example

--Create a window
window = Window:Create()
context = Context:Create(window)
world = World:Create()
camera = Camera:Create()
camera:Move(0,0,-3)
local light = DirectionalLight:Create()
light:SetRotation(35,35,0)

model = Model:Box()
model:SetColor(0.0,0.0,1.0)

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

model:Turn(0,Time:GetSpeed(),0)

local deltazoom = ((window:KeyDown(Key.Up) and 1 or 0) - (window:KeyDown(Key.Down)and 1 or 0)) *Time:GetSpeed()*0.5
local fov = camera:GetFOV() - deltazoom
fov = Math:Clamp(fov,5,179)
camera:SetFOV(fov)

Time:Update()
world:Update()
world:Render()

context:SetBlendMode(Blend.Alpha)
context:DrawText("FOV: "..camera:GetFOV(),2,2)
context:DrawText("Zoom: "..camera:GetZoom(),2,22)

context:Sync()
end