Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Transform2D

A 2×3 matrix representing a 2D transformation.

Description

A 2×3 matrix (2 rows, 3 columns) used for 2D linear transformations. It can represent transformations such as translation, rotation, and scaling. It consists of three Vector2 values: x, y, and the origin.

For more information, read the "Matrices and transforms" documentation article.

Примечание

There are notable differences when using this API with C#. See API различия C# и GDScript for more information.

Tutorials

Properties

Vector2

origin

Vector2(0, 0)

Vector2

x

Vector2(1, 0)

Vector2

y

Vector2(0, 1)

Constructors

Transform2D

Transform2D ( )

Transform2D

Transform2D ( Transform2D from )

Transform2D

Transform2D ( float rotation, Vector2 position )

Transform2D

Transform2D ( float rotation, Vector2 scale, float skew, Vector2 position )

Transform2D

Transform2D ( Vector2 x_axis, Vector2 y_axis, Vector2 origin )

Methods

Transform2D

affine_inverse ( ) const

Vector2

basis_xform ( Vector2 v ) const

Vector2

basis_xform_inv ( Vector2 v ) const

float

determinant ( ) const