Class Transform

Transform metatype, wrapper for godot_transform.

Constructed using the idiom Transform(...), which calls __new.

typedef union godot_transform {
    uint8_t data[48];
    float elements[12];
    struct { Basis basis; Vector3 origin; };
} godot_transform;

Methods

Transform:affine_inverse () Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.
Transform:inverse () Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use affine_inverse for transforms with scaling).
Transform:looking_at (target, up) Returns a copy of the transform rotated such that its -Z axis points towards the target position.
Transform:orthonormalized () Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors.
Transform:rotated (axis, angle) Rotates the transform around the given axis by the given angle (in radians), using matrix multiplication.
Transform:scaled (scale) Scales basis and origin of the transform by the given scale factor, using matrix multiplication.
Transform:treturn (offset) Translates the transform by the given offset, relative to the transform's basis vectors.
Transform:xform (value) Transforms the given Vector3, Plane, AABB, or PoolVector3Array by this transform.
Transform:xform_aabb (aabb) Transforms the given AABB
Transform:xform_inv (value) Inverse-transforms the given Vector3, Plane, AABB, or PoolVector3Array by this transform.
Transform:xform_inv_aabb (aabb) Inverse-transforms the given AABB
Transform:xform_inv_plane (plane) Inverse-transforms the given Plane
Transform:xform_inv_vector3 (vector) Inverse-transforms the given Vector3
Transform:xform_plane (plane) Transforms the given Plane
Transform:xform_vector3 (vector) Transforms the given Vector3

Metamethods

Transform:__concat (a, b) Concatenates values.
Transform:__eq (a, b) Equality operation If either a or b are not of type Transform, always return false.
Transform:__mul (self, b) Multiplication operation.
Transform:__new (...) Transform constructor, called by the idiom Transform(...).
Transform:__tostring () Returns a Lua string representation of this transform.

Constants

Transform.FLIP_X Transform with mirroring applied perpendicular to the YZ plane.
Transform.FLIP_Y Transform with mirroring applied perpendicular to the XZ plane.
Transform.FLIP_Z Transform with mirroring applied perpendicular to the XY plane.
Transform.IDENTITY Transform with no translation, rotation or scaling applied.


Methods

Transform:affine_inverse ()
Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.

Returns:

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

Returns:

    Transform
Transform:looking_at (target, up)
Returns a copy of the transform rotated such that its -Z axis 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:

Returns:

    Transform
Transform:orthonormalized ()
Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors.

Returns:

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

Parameters:

Returns:

    Transform
Transform:scaled (scale)
Scales basis and origin of the transform by the given scale factor, using matrix multiplication.

Parameters:

Returns:

    Transform
Transform:treturn (offset)
Translates the transform by the given offset, relative to the transform's basis vectors. Unlike rotated and scaled, this does not use matrix multiplication.

Parameters:

Returns:

    Transform
Transform:xform (value)
Transforms the given Vector3, Plane, AABB, or PoolVector3Array by this transform.

Parameters:

Returns:

    Vector3, Plane, AABB or PoolVector3Array Transformed value
Transform:xform_aabb (aabb)
Transforms the given AABB

Parameters:

Returns:

    AABB

See also:

Transform:xform_inv (value)
Inverse-transforms the given Vector3, Plane, AABB, or PoolVector3Array by this transform.

Parameters:

Returns:

    Vector3, Plane, AABB or PoolVector3Array Transformed value
Transform:xform_inv_aabb (aabb)
Inverse-transforms the given AABB

Parameters:

Returns:

    AABB

See also:

Transform:xform_inv_plane (plane)
Inverse-transforms the given Plane

Parameters:

Returns:

    Plane

See also:

Transform:xform_inv_vector3 (vector)
Inverse-transforms the given Vector3

Parameters:

Returns:

    Vector3

See also:

Transform:xform_plane (plane)
Transforms the given Plane

Parameters:

Returns:

    Plane

See also:

Transform:xform_vector3 (vector)
Transforms the given Vector3

Parameters:

Returns:

    Vector3

See also:

Metamethods

Transform:__concat (a, b)
Concatenates values.

Parameters:

  • a First value, stringified with GD.str
  • b First value, stringified with GD.str

Returns:

    String
Transform:__eq (a, b)
Equality operation If either a or b are not of type Transform, always return false.

Parameters:

Returns:

    bool
Transform:__mul (self, b)
Multiplication operation. Either multiply another Transform or xform value.

Parameters:

Returns:

    Transform, Vector3, Plane, AABB or PoolVector3Array Transformed value
Transform:__new (...)

Transform constructor, called by the idiom Transform(...).

  • Transform(): IDENTITY transform
  • Transform(Basis basis[, Vector3 origin = Vector3.ZERO]): set basis and origin
  • Transform(Quat quat[, Vector3 origin = Vector3.ZERO]): set basis from quaternion and origin
  • Transform(Vector3 euler[, Vector3 origin = Vector3.ZERO]): set basis from Euler angles and origin
  • Transform(Vector3 x, Vector3 y, Vector3 z, Vector3 origin): constructs the transform from the four column vectors.
  • Transform(Transform other): returns a copy of other

Parameters:

  • ...

Returns:

    Transform
Transform:__tostring ()
Returns a Lua string representation of this transform.

Returns:

    string

Constants

Transform.FLIP_X
Transform with mirroring applied perpendicular to the YZ plane.
  • FLIP_X Transform(-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
Transform.FLIP_Y
Transform with mirroring applied perpendicular to the XZ plane.
  • FLIP_Y Transform(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0)
Transform.FLIP_Z
Transform with mirroring applied perpendicular to the XY plane.
  • FLIP_Z Transform(1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0)
Transform.IDENTITY
Transform with no translation, rotation or scaling applied.
  • IDENTITY Transform(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
generated by LDoc 1.4.6 Last updated 2023-01-04 08:52:34