• Camera runtime API functions.

Static methods

@:native("get_aspect_ratio")staticgetAspectRatio(camera:HashOrStringOrUrl):Float

  • Gets the effective aspect ratio of the camera.

If auto aspect ratio is enabled, returns the aspect ratio calculated from the current render target. Otherwise returns the manually set aspect ratio.

Parameters:

camera

camera id

Returns:

the effective aspect ratio

@:native("get_auto_aspect_ratio")staticgetAutoAspectRatio(camera:HashOrStringOrUrl):Bool

  • Returns whether auto aspect ratio calculation is enabled.

When enabled, the camera automatically calculates aspect ratio from render target dimensions. When disabled, uses the manually set aspect ratio value.

Parameters:

camera

camera id

Returns:

true if auto aspect ratio is enabled

@:native("get_cameras")staticgetCameras():Table<Any, Url>

  • Returns all camera URLs registered in the render context.

Returns:

a table with all camera URLs

@:native("get_enabled")staticgetEnabled(camera:HashOrStringOrUrl):Bool

  • Returns true if a camera component is enabled.

Parameters:

camera
camera id (urlhashstring)

Returns:

true if the camera is enabled

@:native("get_far_z")staticgetFarZ(camera:HashOrStringOrUrl):Float

  • Returns the far z for the camera frustum.

Parameters:

camera

camera id

Returns:

the far z

@:native("get_fov")staticgetFov(camera:HashOrStringOrUrl):Float

  • Returns the vertical field of view.

Parameters:

camera

camera id

Returns:

the field of view

@:native("get_near_z")staticgetNearZ(camera:HashOrStringOrUrl):Float

  • Returns the near z for the camera frustum.

Parameters:

camera

camera id

Returns:

the near z

@:native("get_orthographic_mode")staticgetOrthographicMode(camera:HashOrStringOrUrl):CameraOrthoMode

  • Returns the orthographic zoom mode.

Parameters:

camera

camera id

Returns:

one of CameraOrthoMode values

@:native("get_orthographic_zoom")staticgetOrthographicZoom(camera:HashOrStringOrUrl):Float

  • Returns the orthographic zoom value.

Parameters:

camera

camera id

Returns:

the orthographic zoom

@:native("get_projection")staticgetProjection(camera:HashOrStringOrUrl):Matrix4

  • Returns the calculated projection matrix.

Parameters:

camera

camera id

Returns:

the projection matrix

@:native("get_view")staticgetView(camera:HashOrStringOrUrl):Matrix4

  • Returns the calculated view matrix.

Parameters:

camera

camera id

Returns:

the view matrix

@:native("set_aspect_ratio")staticsetAspectRatio(camera:HashOrStringOrUrl, aspect_ratio:Float):Void

  • Sets the manual aspect ratio for the camera.

This value is only used when auto aspect ratio is disabled.

Parameters:

camera

camera id

aspect_ratio

the manual aspect ratio value

@:native("set_auto_aspect_ratio")staticsetAutoAspectRatio(camera:HashOrStringOrUrl, auto:Bool):Void

  • Enables or disables automatic aspect ratio calculation.

When enabled (true), the camera automatically calculates aspect ratio from render target dimensions. When disabled (false), uses the manually set aspect ratio value.

Parameters:

camera

camera id

auto

true to enable auto aspect ratio

@:native("set_far_z")staticsetFarZ(camera:HashOrStringOrUrl, far_z:Float):Void

  • Sets the far z of the camera frustum.

Parameters:

camera

camera id

far_z

the far z

@:native("set_fov")staticsetFov(camera:HashOrStringOrUrl, fov:Float):Void

  • Sets the vertical field of view.

Parameters:

camera

camera id

fov

the field of view

@:native("set_near_z")staticsetNearZ(camera:HashOrStringOrUrl, near_z:Float):Void

  • Sets the near z of the camera frustum.

Parameters:

camera

camera id

near_z

the near z

@:native("set_orthographic_mode")staticsetOrthographicMode(camera:HashOrStringOrUrl, mode:CameraOrthoMode):Void

  • Sets the orthographic zoom mode.

Parameters:

camera

camera id

mode

one of CameraOrthoMode values

@:native("set_orthographic_zoom")staticsetOrthographicZoom(camera:HashOrStringOrUrl, zoom:Float):Void

  • Sets the orthographic zoom value.

Parameters:

camera

camera id

zoom

the orthographic zoom value