/Godot 2.1

# Transform

Category: Built-In Types

## Brief Description

3D Transformation.

## Member Functions

 Transform Transform ( Vector3 x_axis, Vector3 y_axis, Vector3 z_axis, Vector3 origin ) Transform Transform ( Matrix3 basis, Vector3 origin ) Transform Transform ( Matrix32 from ) Transform Transform ( Quat from ) Transform Transform ( Matrix3 from ) Transform affine_inverse ( ) Transform inverse ( ) Transform looking_at ( Vector3 target, Vector3 up ) Transform orthonormalized ( ) Transform rotated ( Vector3 axis, float phi ) Transform scaled ( Vector3 scale ) Transform translated ( Vector3 ofs ) var xform ( var v ) var xform_inv ( var v )

## Member Variables

• Matrix3 basis - The basis contains 3 [Vector3]. X axis, Y axis, and Z axis.
• Vector3 origin - The origin of the transform. Which is the translation offset.

## Description

Transform is used to store transformations, including translations. It consists of a Matrix3 “basis” and Vector3 “origin”. Transform is used to represent transformations of any object in space. It is similar to a 4x3 matrix.

## Member Function Description

### Transform Transform ( Vector3 x_axis, Vector3 y_axis, Vector3 z_axis, Vector3 origin )

Construct the Transform from four Vector3. Each axis creates the basis.

### Transform Transform ( Matrix3 basis, Vector3 origin )

Construct the Transform from a Matrix3 and Vector3.

### Transform Transform ( Matrix32 from )

Construct the Transform from a Matrix32.

### Transform Transform ( Quat from )

Construct the Transform from a Quat. The origin will be Vector3(0, 0, 0)

### Transform Transform ( Matrix3 from )

Construct the Transform from a Matrix3. The origin will be Vector3(0, 0, 0)

### Transform affine_inverse ( )

Returns the inverse of the transfrom, even if the transform has scale or the axis vectors are not orthogonal.

### Transform inverse ( )

Returns the inverse of the transform.

### Transform looking_at ( Vector3 target, Vector3 up )

Rotate the transform around the up vector to face the target.

### Transform orthonormalized ( )

Returns a transfrom with the basis orthogonal (90 degrees), and normalized axis vectors.

### Transform rotated ( Vector3 axis, float phi )

Rotate the transform locally.

### Transform scaled ( Vector3 scale )

Scale the transform locally.

### Transform translated ( Vector3 ofs )

Translate the transform locally.

### var xform ( var v )

Transforms vector “v” by this transform.

### var xform_inv ( var v )

Inverse-transforms vector “v” by this transform.

© 2014–2017 Juan Linietsky, Ariel Manzur, Godot Engine contributors