Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Projection

A 4×4 matrix for 3D projective transformations.

Description

A 4x4 matrix used for 3D projective transformations. It can represent transformations such as translation, rotation, scaling, shearing, and perspective division. It consists of four Vector4 columns.

For purely linear transformations (translation, rotation, and scale), it is recommended to use Transform3D, as it is more performant and requires less memory.

Used internally as Camera3D's projection matrix.

Note

There are notable differences when using this API with C#. See C# API differences to GDScript for more information.

Properties

Vector4

w

Vector4(0, 0, 0, 1)

Vector4

x

Vector4(1, 0, 0, 0)

Vector4

y

Vector4(0, 1, 0, 0)

Vector4

z

Vector4(0, 0, 1, 0)

Constructors

Projection

Projection()

Projection

Projection(from: Projection)

Projection

Projection(from: Transform3D)

Projection

Projection(x_axis: Vector4, y_axis: Vector4, z_axis: Vector4, w_axis: Vector4)

Methods

Projection

create_depth_correction(flip_y: bool) static

Projection

create_fit_aabb(aabb: AABB) static

Projection

create_for_hmd(eye: int, aspect: float, intraocular_dist: float, display_width: float, display_to_lens: float, oversample: float, z_near: float, z_far: float) static

Projection

create_frustum(left: float, right: float, bottom: float, top: float, z_near: float, z_far: float) static

Projection

create_frustum_aspect(size: float, aspect: float, offset: Vector2, z_near: float, z_far: float, flip_fov: bool = false) static

Projection

create_light_atlas_rect(rect: Rect2) static

Projection

create_orthogonal(left: float, right: float, bottom: float, top: float, z_near: float, z_far: float) static

Projection

create_orthogonal_aspect(size: float, aspect: float, z_near: float, z_far: float, flip_fov: bool = false) static

Projection

create_perspective(fovy: float, aspect: float, z_near: float, z_far: float, flip_fov: bool = false) static

Projection

create_perspective_hmd(fovy: float, aspect: float, z_near: float, z_far: float, flip_fov: bool, eye: int, intraocular_dist: float, convergence_dist: float) static

float

determinant() const

Projection

flipped_y() const

float

get_aspect() const

Vector2

get_far_plane_half_extents() const

float

get_fov()