3×4 matrix (3 rows, 4 columns) used for 3D linear transformations. It can represent transformations such as translation, rotation, or scaling. It consists of a godot.Basis (first 3 columns) and a godot.Vector3 for the origin (last column).

For more information, read this documentation article: https://docs.godotengine.org/en/3.4/tutorials/math/matrices_and_transforms.html

Static variables

@:native("FlipX")staticread onlyFLIP_X:Transform

The transform that will flip something along the X axis.

Value: Equivalent to new Transform(Vector3.Left, Vector3.Up, Vector3.Back, Vector3.Zero).

@:native("FlipY")staticread onlyFLIP_Y:Transform

The transform that will flip something along the Y axis.

Value: Equivalent to new Transform(Vector3.Right, Vector3.Down, Vector3.Back, Vector3.Zero).

@:native("FlipZ")staticread onlyFLIP_Z:Transform

The transform that will flip something along the Z axis.

Value: Equivalent to new Transform(Vector3.Right, Vector3.Up, Vector3.Forward, Vector3.Zero).

@:native("Identity")staticread onlyIDENTITY:Transform

The identity transform, with no translation, rotation, or scaling applied. This is used as a replacement for Transform() in GDScript. Do not use new Transform() with no arguments in C#, because it sets all values to zero.

Value: Equivalent to new Transform(Vector3.Right, Vector3.Up, Vector3.Back, Vector3.Zero).

Static methods

@:op(A == B)staticinlineop_Equality(left:Transform, right:Transform):Bool

Operator overload for godot.Transform == godot.Transform.

@:op(A != B)staticinlineop_Inequality(left:Transform, right:Transform):Bool

Operator overload for godot.Transform != godot.Transform.

@:op(A * B)staticinlineop_Multiply(left:Transform, right:Transform):Transform

Operator overload for godot.Transform * godot.Transform.

Constructor

@:native("new")new(column0:Vector3, column1:Vector3, column2:Vector3, origin:Vector3)

@:native("new")new(basis:Basis, origin:Vector3)

@:native("new")new(quaternion:Quat, origin:Vector3)

Constructs a transformation matrix from 4 vectors (matrix columns).

Parameters:

column0

The X vector, or column index 0.

column1

The Y vector, or column index 1.

column2

The Z vector, or column index 2.

origin

The origin vector, or column index 3.

Variables

@:native("basis")basis:Basis

The godot.Basis of this transform. Contains the X, Y, and Z basis vectors (columns 0 to 2) and is responsible for rotation and scale.

@:native("origin")origin:Vector3

The origin vector (column 3, the fourth column). Equivalent to array index [3].

Methods

@:native("AffineInverse")affineInverse():Transform

Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling, and translation.

Returns:

The inverse transformation matrix.

See also:

@:native("InterpolateWith")interpolateWith(transform:Transform, weight:Single):Transform

Interpolates this transform to the other transform by weight.

Parameters:

transform

The other transform.

weight

A value on the range of 0.0 to 1.0, representing the amount of interpolation.

Returns:

The interpolated transform.

@:native("Inverse")inverse():Transform

Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use godot.Transform.affineInverse for transforms with scaling).

Returns:

The inverse matrix.

@:native("IsEqualApprox")isEqualApprox(other:Transform):Bool

Returns true if this transform and other are approximately equal, by running godot.Vector3.isEqualApprox on each component.

Parameters:

other

The other transform to compare.

Returns:

Whether or not the matrices are approximately equal.

@:native("LookingAt")lookingAt(target:Vector3, up:Vector3):Transform

Returns a copy of the transform rotated such that its -Z axis (forward) points towards the target position.

The transform will first be rotated around the given up vector, and then fully aligned to the target by a further rotation around an axis perpendicular to both the target and up vectors.

Operations take place in global space.

Parameters:

target

The object to look at.

up

The relative up direction

Returns:

The resulting transform.

@:native("Orthonormalized")orthonormalized():Transform

Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors (scale of 1 or -1).

Returns:

The orthonormalized transform.

@:native("Rotated")rotated(axis:Vector3, phi:Single):Transform

Rotates the transform around the given axis by phi (in radians), using matrix multiplication. The axis must be a normalized vector.

Parameters:

axis

The axis to rotate around. Must be normalized.

phi

The angle to rotate, in radians.

Returns:

The rotated transformation matrix.

@:native("Scaled")scaled(scale:Vector3):Transform

Scales the transform by the given 3D scaling factor, using matrix multiplication.

Parameters:

scale

The scale to introduce.

Returns:

The scaled transformation matrix.

@:native("ToString")toString():String

@:native("ToString")ToString(format:String):String

Converts this godot.Transform to a string.

Returns:

A string representation of this transform.

@:native("Translated")translated(offset:Vector3):Transform

Translates the transform by the given offset, relative to the transform's basis vectors.

Unlike godot.Transform.rotated and godot.Transform.scaled, this does not use matrix multiplication.

Parameters:

offset

The offset to translate by.

Returns:

The translated matrix.

@:native("Xform")xform(v:Vector3):Vector3

Returns a vector transformed (multiplied) by this transformation matrix.

Parameters:

v

A vector to transform.

Returns:

The transformed vector.

See also:

@:native("XformInv")xformInv(v:Vector3):Vector3

Returns a vector transformed (multiplied) by the transposed transformation matrix.

Note: This results in a multiplication by the inverse of the transformation matrix only if it represents a rotation-reflection.

Parameters:

v

A vector to inversely transform.

Returns:

The inversely transformed vector.

See also: