Skip to main content

Perspective lens

Perspective lens API provides methods to access and modify perspective lens component.

Properties​

near: number​

Perspective near plane value.

local near = entity.perspectiveLens.near
entity.perspectiveLens.near = 0.01

far: number​

Perspective far plane value.

local far = entity.perspectiveLens.far
entity.perspectiveLens.far = 1000.0

focalLength: number​

Lens focal length value represented in mm.

local focalLength = entity.perspectiveLens.focalLength
entity.perspectiveLens.focalLength = 23.0

aperture: number​

Lens aperture represented in inverse of f-stops. Example: 1/2.2 f-stop is returned as 2.2

local aperture = entity.perspectiveLens.aperture
entity.perspectiveLens.aperture = 16.0

shutterSpeed: number​

Camera shutter speed represented in inverse of 1/s. Example: 1/2000 s is returned as 2000.

local shutterSpeed = entity.perspectiveLens.shutterSpeed
entity.perspectiveLens.shutterSpeed = 250.0

sensitivity: number​

Camera sensitivity represented in ISO values, which are positive integers.

local sensitivity = entity.perspectiveLens.sensitivity
entity.perspectiveLens.sensitivity = 200

Methods​

getSensorSize(): number, number​

Get camera sensor size.

local width, height = entity.perspectiveLens:getSensorSize()

Returns:

The function returns two values -- sensor size width and height values that are positive numbers and measured in mm.


setSensorSize(width: number, height: number): void​

Set camera sensor size.

entity.perspectiveLens:setSensorSize(23.6, 15.6)

Parameters:

  • width: Sensor width that is a positive number measured in mm.
  • height: Sensor height that is a positive number measured in mm.

delete(): void​

Delete perspective lens component.

entity.perspectiveLens:delete()