GetZoom

This function gets a camera's zoom. The default camera zoom is 1.0.

Syntax

Returns

Returns the camera zoom value. Values greater than 1.0 will "zoom in" and values less than 1.0 will "zoom out".

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