Lysa.nodes  0.0
Lysa 3D Engine
Camera Class Referenceabstract

Detailed Description

A scene camera node providing perspective or orthographic projection.

Inherits from: Node

Lua full name: lysa.nodes.Camera

Public Member Functions

Camera create ()static
 Creates a Camera with default perspective settings. More...
 
Camera create (name: string)static
 Creates a named Camera with default perspective settings. More...
 
Camera create (fov: number, near: number, far: number)static
 Creates a perspective Camera with the given field-of-view (degrees) and near/far clipping distances. More...
 
Camera create (left: number, right: number, top: number, bottom: number, near: number, far: number)static
 Creates an orthographic Camera with explicit frustum bounds. More...
 
nil set_perspective_projection (fov: number, aspect: number, near: number, far: number)
 Switches to perspective projection with the given FOV (degrees), aspect ratio, and clipping distances. More...
 
nil set_orthographic_projection (left: number, right: number, bottom: number, top: number, near: number, far: number)
 Switches to orthographic projection with explicit frustum bounds. More...
 
nil set_fov (fov: number)
 Sets the vertical field of view in degrees (perspective mode only). More...
 
nil set_aspect_ratio (ratio: number)
 Sets the aspect ratio (width / height) of the camera frustum. More...
 
lysa.Ray screen_to_world (screen_pos: lysa.float2, screen_size: lysa.float2)
 Unprojects a 2-D screen-space position to a world-space ray originating at the camera. More...
 
MeshInstance|nil ray_cast (point: lysa.float3, ignore: MeshInstance|nil)
 Casts a ray from the camera's world position toward a target world-space point and returns the first MeshInstance hit, optionally ignoring one instance. More...
 
MeshInstance[] ray_cast_aabb (target: MeshInstance, all: boolean|nil)
 Casts rays from the camera toward all 8 corners of the target's world-space AABB; returns the list of hit MeshInstances. Pass all=true to collect every hit rather than stopping at the first. More...
 

Properties

lysa.float4x4 projection
 The current projection matrix. (read-only)
 
CameraProjectionType projection_type
 The current projection mode (PERSPECTIVE or ORTHOGRAPHIC). (read-only)
 
number near_distance
 The near clipping plane distance.
 
number far_distance
 The far clipping plane distance.
 

Member Function Documentation

Camera create ( )
static

Creates a Camera with default perspective settings.

Returns
Camera
Camera create ( string  name)
static

Creates a named Camera with default perspective settings.

Parameters
namestring
Returns
Camera
Camera create ( number  fov,
number  near,
number  far)
static

Creates a perspective Camera with the given field-of-view (degrees) and near/far clipping distances.

Parameters
fovnumber
nearnumber
farnumber
Returns
Camera
Camera create ( number  left,
number  right,
number  top,
number  bottom,
number  near,
number  far)
static

Creates an orthographic Camera with explicit frustum bounds.

Parameters
leftnumber
rightnumber
topnumber
bottomnumber
nearnumber
farnumber
Returns
Camera
nil set_perspective_projection ( number  fov,
number  aspect,
number  near,
number  far)

Switches to perspective projection with the given FOV (degrees), aspect ratio, and clipping distances.

Parameters
fovnumber
aspectnumber
nearnumber
farnumber
nil set_orthographic_projection ( number  left,
number  right,
number  bottom,
number  top,
number  near,
number  far)

Switches to orthographic projection with explicit frustum bounds.

Parameters
leftnumber
rightnumber
bottomnumber
topnumber
nearnumber
farnumber
nil set_fov ( number  fov)

Sets the vertical field of view in degrees (perspective mode only).

Parameters
fovnumber
nil set_aspect_ratio ( number  ratio)

Sets the aspect ratio (width / height) of the camera frustum.

Parameters
rationumber
lysa.Ray screen_to_world ( lysa.float2  screen_pos,
lysa.float2  screen_size)

Unprojects a 2-D screen-space position to a world-space ray originating at the camera.

Parameters
screen_poslysa.float2
screen_sizelysa.float2
Returns
lysa.Ray
MeshInstance|nil ray_cast ( lysa.float3  point,
MeshInstance|nil  ignore)

Casts a ray from the camera's world position toward a target world-space point and returns the first MeshInstance hit, optionally ignoring one instance.

Parameters
pointlysa.float3
ignoreMeshInstance|nil
Returns
MeshInstance|nil
MeshInstance[] ray_cast_aabb ( MeshInstance  target,
boolean|nil  all)

Casts rays from the camera toward all 8 corners of the target's world-space AABB; returns the list of hit MeshInstances. Pass all=true to collect every hit rather than stopping at the first.

Parameters
targetMeshInstance
allboolean|nil
Returns
MeshInstance[]

Property Documentation

lysa.float4x4 projection

The current projection matrix. (read-only)

CameraProjectionType projection_type

The current projection mode (PERSPECTIVE or ORTHOGRAPHIC). (read-only)

number near_distance

The near clipping plane distance.

number far_distance

The far clipping plane distance.