:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the Transform.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_Transform: Transform ========= **Category:** Built-In Types Brief Description ----------------- 3D Transformation. 3x4 matrix. Properties ---------- +-------------------------------+------------------------------------------------+ | :ref:`Basis` | :ref:`basis` | +-------------------------------+------------------------------------------------+ | :ref:`Vector3` | :ref:`origin` | +-------------------------------+------------------------------------------------+ Methods ------- +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`Transform` **(** :ref:`Vector3` x_axis, :ref:`Vector3` y_axis, :ref:`Vector3` z_axis, :ref:`Vector3` origin **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`Transform` **(** :ref:`Basis` basis, :ref:`Vector3` origin **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`Transform` **(** :ref:`Transform2D` from **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`Transform` **(** :ref:`Quat` from **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`Transform` **(** :ref:`Basis` from **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`affine_inverse` **(** **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`interpolate_with` **(** :ref:`Transform` transform, :ref:`float` weight **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`inverse` **(** **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`looking_at` **(** :ref:`Vector3` target, :ref:`Vector3` up **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`orthonormalized` **(** **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`rotated` **(** :ref:`Vector3` axis, :ref:`float` phi **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`scaled` **(** :ref:`Vector3` scale **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`translated` **(** :ref:`Vector3` ofs **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`xform` **(** :ref:`Variant` v **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`xform_inv` **(** :ref:`Variant` v **)** | +-----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Constants --------- .. _class_Transform_constant_IDENTITY: .. _class_Transform_constant_FLIP_X: .. _class_Transform_constant_FLIP_Y: .. _class_Transform_constant_FLIP_Z: - **IDENTITY** = **Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )** --- :ref:`Transform` with no translation, rotation or scaling applied. When applied to other data structures, :ref:`IDENTITY` performs no transformation. - **FLIP_X** = **Transform( -1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )** --- :ref:`Transform` with mirroring applied perpendicular to the YZ plane. - **FLIP_Y** = **Transform( 1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0 )** --- :ref:`Transform` with mirroring applied perpendicular to the XZ plane. - **FLIP_Z** = **Transform( 1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0 )** --- :ref:`Transform` with mirroring applied perpendicular to the XY plane. Description ----------- Represents one or many transformations in 3D space such as translation, rotation, or scaling. It consists of a :ref:`Basis` "basis" and an :ref:`Vector3` "origin". It is similar to a 3x4 matrix. Tutorials --------- - :doc:`../tutorials/math/index` - :doc:`../tutorials/3d/using_transforms` Property Descriptions --------------------- .. _class_Transform_property_basis: - :ref:`Basis` **basis** The basis is a matrix containing 3 :ref:`Vector3` as its columns: X axis, Y axis, and Z axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object. ---- .. _class_Transform_property_origin: - :ref:`Vector3` **origin** The translation offset of the transform. Method Descriptions ------------------- .. _class_Transform_method_Transform: - :ref:`Transform` **Transform** **(** :ref:`Vector3` x_axis, :ref:`Vector3` y_axis, :ref:`Vector3` z_axis, :ref:`Vector3` origin **)** Constructs the Transform from four :ref:`Vector3`. Each axis corresponds to local basis vectors (some of which may be scaled). ---- - :ref:`Transform` **Transform** **(** :ref:`Basis` basis, :ref:`Vector3` origin **)** Constructs the Transform from a :ref:`Basis` and :ref:`Vector3`. ---- - :ref:`Transform` **Transform** **(** :ref:`Transform2D` from **)** Constructs the Transform from a :ref:`Transform2D`. ---- - :ref:`Transform` **Transform** **(** :ref:`Quat` from **)** Constructs the Transform from a :ref:`Quat`. The origin will be Vector3(0, 0, 0). ---- - :ref:`Transform` **Transform** **(** :ref:`Basis` from **)** Constructs the Transform from a :ref:`Basis`. The origin will be Vector3(0, 0, 0). ---- .. _class_Transform_method_affine_inverse: - :ref:`Transform` **affine_inverse** **(** **)** Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation. ---- .. _class_Transform_method_interpolate_with: - :ref:`Transform` **interpolate_with** **(** :ref:`Transform` transform, :ref:`float` weight **)** Interpolates the transform to other Transform by weight amount (0-1). ---- .. _class_Transform_method_inverse: - :ref:`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). ---- .. _class_Transform_method_looking_at: - :ref:`Transform` **looking_at** **(** :ref:`Vector3` target, :ref:`Vector3` 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. ---- .. _class_Transform_method_orthonormalized: - :ref:`Transform` **orthonormalized** **(** **)** Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors. ---- .. _class_Transform_method_rotated: - :ref:`Transform` **rotated** **(** :ref:`Vector3` axis, :ref:`float` phi **)** Rotates the transform around given axis by phi. The axis must be a normalized vector. ---- .. _class_Transform_method_scaled: - :ref:`Transform` **scaled** **(** :ref:`Vector3` scale **)** Scales the transform by the specified 3D scaling factors. ---- .. _class_Transform_method_translated: - :ref:`Transform` **translated** **(** :ref:`Vector3` ofs **)** Translates the transform by the specified offset. ---- .. _class_Transform_method_xform: - :ref:`Variant` **xform** **(** :ref:`Variant` v **)** Transforms the given :ref:`Vector3`, :ref:`Plane`, or :ref:`AABB` by this transform. ---- .. _class_Transform_method_xform_inv: - :ref:`Variant` **xform_inv** **(** :ref:`Variant` v **)** Inverse-transforms the given :ref:`Vector3`, :ref:`Plane`, or :ref:`AABB` by this transform.