class_transform3d.rst 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/Transform3D.xml.
  6. .. _class_Transform3D:
  7. Transform3D
  8. ===========
  9. A 3×4 matrix representing a 3D transformation.
  10. .. rst-class:: classref-introduction-group
  11. Description
  12. -----------
  13. The **Transform3D** built-in :ref:`Variant<class_Variant>` type is a 3×4 matrix representing a transformation in 3D space. It contains a :ref:`Basis<class_Basis>`, which on its own can represent rotation, scale, and shear. Additionally, combined with its own :ref:`origin<class_Transform3D_property_origin>`, the transform can also represent a translation.
  14. For a general introduction, see the :doc:`Matrices and transforms <../tutorials/math/matrices_and_transforms>` tutorial.
  15. \ **Note:** Godot uses a `right-handed coordinate system <https://en.wikipedia.org/wiki/Right-hand_rule>`__, which is a common standard. For directions, the convention for built-in types like :ref:`Camera3D<class_Camera3D>` is for -Z to point forward (+X is right, +Y is up, and +Z is back). Other objects may use different direction conventions. For more information, see the `3D asset direction conventions <../tutorials/assets_pipeline/importing_3d_scenes/model_export_considerations.html#d-asset-direction-conventions>`__ tutorial.
  16. .. note::
  17. There are notable differences when using this API with C#. See :ref:`doc_c_sharp_differences` for more information.
  18. .. rst-class:: classref-introduction-group
  19. Tutorials
  20. ---------
  21. - :doc:`Math documentation index <../tutorials/math/index>`
  22. - :doc:`Matrices and transforms <../tutorials/math/matrices_and_transforms>`
  23. - :doc:`Using 3D transforms <../tutorials/3d/using_transforms>`
  24. - `Matrix Transform Demo <https://godotengine.org/asset-library/asset/2787>`__
  25. - `3D Platformer Demo <https://godotengine.org/asset-library/asset/2748>`__
  26. - `2.5D Game Demo <https://godotengine.org/asset-library/asset/2783>`__
  27. .. rst-class:: classref-reftable-group
  28. Properties
  29. ----------
  30. .. table::
  31. :widths: auto
  32. +-------------------------------+--------------------------------------------------+--------------------------------------+
  33. | :ref:`Basis<class_Basis>` | :ref:`basis<class_Transform3D_property_basis>` | ``Basis(1, 0, 0, 0, 1, 0, 0, 0, 1)`` |
  34. +-------------------------------+--------------------------------------------------+--------------------------------------+
  35. | :ref:`Vector3<class_Vector3>` | :ref:`origin<class_Transform3D_property_origin>` | ``Vector3(0, 0, 0)`` |
  36. +-------------------------------+--------------------------------------------------+--------------------------------------+
  37. .. rst-class:: classref-reftable-group
  38. Constructors
  39. ------------
  40. .. table::
  41. :widths: auto
  42. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`Transform3D<class_Transform3D>` | :ref:`Transform3D<class_Transform3D_constructor_Transform3D>`\ (\ ) |
  44. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`Transform3D<class_Transform3D>` | :ref:`Transform3D<class_Transform3D_constructor_Transform3D>`\ (\ from\: :ref:`Transform3D<class_Transform3D>`\ ) |
  46. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`Transform3D<class_Transform3D>` | :ref:`Transform3D<class_Transform3D_constructor_Transform3D>`\ (\ basis\: :ref:`Basis<class_Basis>`, origin\: :ref:`Vector3<class_Vector3>`\ ) |
  48. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Transform3D<class_Transform3D>` | :ref:`Transform3D<class_Transform3D_constructor_Transform3D>`\ (\ from\: :ref:`Projection<class_Projection>`\ ) |
  50. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`Transform3D<class_Transform3D>` | :ref:`Transform3D<class_Transform3D_constructor_Transform3D>`\ (\ x_axis\: :ref:`Vector3<class_Vector3>`, y_axis\: :ref:`Vector3<class_Vector3>`, z_axis\: :ref:`Vector3<class_Vector3>`, origin\: :ref:`Vector3<class_Vector3>`\ ) |
  52. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. .. rst-class:: classref-reftable-group
  54. Methods
  55. -------
  56. .. table::
  57. :widths: auto
  58. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`Transform3D<class_Transform3D>` | :ref:`affine_inverse<class_Transform3D_method_affine_inverse>`\ (\ ) |const| |
  60. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`Transform3D<class_Transform3D>` | :ref:`interpolate_with<class_Transform3D_method_interpolate_with>`\ (\ xform\: :ref:`Transform3D<class_Transform3D>`, weight\: :ref:`float<class_float>`\ ) |const| |
  62. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`Transform3D<class_Transform3D>` | :ref:`inverse<class_Transform3D_method_inverse>`\ (\ ) |const| |
  64. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`bool<class_bool>` | :ref:`is_equal_approx<class_Transform3D_method_is_equal_approx>`\ (\ xform\: :ref:`Transform3D<class_Transform3D>`\ ) |const| |
  66. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`bool<class_bool>` | :ref:`is_finite<class_Transform3D_method_is_finite>`\ (\ ) |const| |
  68. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`Transform3D<class_Transform3D>` | :ref:`looking_at<class_Transform3D_method_looking_at>`\ (\ target\: :ref:`Vector3<class_Vector3>`, up\: :ref:`Vector3<class_Vector3>` = Vector3(0, 1, 0), use_model_front\: :ref:`bool<class_bool>` = false\ ) |const| |
  70. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`Transform3D<class_Transform3D>` | :ref:`orthonormalized<class_Transform3D_method_orthonormalized>`\ (\ ) |const| |
  72. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`Transform3D<class_Transform3D>` | :ref:`rotated<class_Transform3D_method_rotated>`\ (\ axis\: :ref:`Vector3<class_Vector3>`, angle\: :ref:`float<class_float>`\ ) |const| |
  74. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`Transform3D<class_Transform3D>` | :ref:`rotated_local<class_Transform3D_method_rotated_local>`\ (\ axis\: :ref:`Vector3<class_Vector3>`, angle\: :ref:`float<class_float>`\ ) |const| |
  76. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`Transform3D<class_Transform3D>` | :ref:`scaled<class_Transform3D_method_scaled>`\ (\ scale\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  78. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`Transform3D<class_Transform3D>` | :ref:`scaled_local<class_Transform3D_method_scaled_local>`\ (\ scale\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  80. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`Transform3D<class_Transform3D>` | :ref:`translated<class_Transform3D_method_translated>`\ (\ offset\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  82. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`Transform3D<class_Transform3D>` | :ref:`translated_local<class_Transform3D_method_translated_local>`\ (\ offset\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  84. +---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. .. rst-class:: classref-reftable-group
  86. Operators
  87. ---------
  88. .. table::
  89. :widths: auto
  90. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`bool<class_bool>` | :ref:`operator !=<class_Transform3D_operator_neq_Transform3D>`\ (\ right\: :ref:`Transform3D<class_Transform3D>`\ ) |
  92. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`AABB<class_AABB>` | :ref:`operator *<class_Transform3D_operator_mul_AABB>`\ (\ right\: :ref:`AABB<class_AABB>`\ ) |
  94. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`operator *<class_Transform3D_operator_mul_PackedVector3Array>`\ (\ right\: :ref:`PackedVector3Array<class_PackedVector3Array>`\ ) |
  96. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`Plane<class_Plane>` | :ref:`operator *<class_Transform3D_operator_mul_Plane>`\ (\ right\: :ref:`Plane<class_Plane>`\ ) |
  98. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  99. | :ref:`Transform3D<class_Transform3D>` | :ref:`operator *<class_Transform3D_operator_mul_Transform3D>`\ (\ right\: :ref:`Transform3D<class_Transform3D>`\ ) |
  100. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`Vector3<class_Vector3>` | :ref:`operator *<class_Transform3D_operator_mul_Vector3>`\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) |
  102. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`Transform3D<class_Transform3D>` | :ref:`operator *<class_Transform3D_operator_mul_float>`\ (\ right\: :ref:`float<class_float>`\ ) |
  104. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`Transform3D<class_Transform3D>` | :ref:`operator *<class_Transform3D_operator_mul_int>`\ (\ right\: :ref:`int<class_int>`\ ) |
  106. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`Transform3D<class_Transform3D>` | :ref:`operator /<class_Transform3D_operator_div_float>`\ (\ right\: :ref:`float<class_float>`\ ) |
  108. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  109. | :ref:`Transform3D<class_Transform3D>` | :ref:`operator /<class_Transform3D_operator_div_int>`\ (\ right\: :ref:`int<class_int>`\ ) |
  110. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  111. | :ref:`bool<class_bool>` | :ref:`operator ==<class_Transform3D_operator_eq_Transform3D>`\ (\ right\: :ref:`Transform3D<class_Transform3D>`\ ) |
  112. +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  113. .. rst-class:: classref-section-separator
  114. ----
  115. .. rst-class:: classref-descriptions-group
  116. Constants
  117. ---------
  118. .. _class_Transform3D_constant_IDENTITY:
  119. .. rst-class:: classref-constant
  120. **IDENTITY** = ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` :ref:`🔗<class_Transform3D_constant_IDENTITY>`
  121. A transform with no translation, no rotation, and its scale being ``1``. Its :ref:`basis<class_Transform3D_property_basis>` is equal to :ref:`Basis.IDENTITY<class_Basis_constant_IDENTITY>`.
  122. When multiplied by another :ref:`Variant<class_Variant>` such as :ref:`AABB<class_AABB>` or another **Transform3D**, no transformation occurs.
  123. .. _class_Transform3D_constant_FLIP_X:
  124. .. rst-class:: classref-constant
  125. **FLIP_X** = ``Transform3D(-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` :ref:`🔗<class_Transform3D_constant_FLIP_X>`
  126. **Transform3D** with mirroring applied perpendicular to the YZ plane. Its :ref:`basis<class_Transform3D_property_basis>` is equal to :ref:`Basis.FLIP_X<class_Basis_constant_FLIP_X>`.
  127. .. _class_Transform3D_constant_FLIP_Y:
  128. .. rst-class:: classref-constant
  129. **FLIP_Y** = ``Transform3D(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0)`` :ref:`🔗<class_Transform3D_constant_FLIP_Y>`
  130. **Transform3D** with mirroring applied perpendicular to the XZ plane. Its :ref:`basis<class_Transform3D_property_basis>` is equal to :ref:`Basis.FLIP_Y<class_Basis_constant_FLIP_Y>`.
  131. .. _class_Transform3D_constant_FLIP_Z:
  132. .. rst-class:: classref-constant
  133. **FLIP_Z** = ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0)`` :ref:`🔗<class_Transform3D_constant_FLIP_Z>`
  134. **Transform3D** with mirroring applied perpendicular to the XY plane. Its :ref:`basis<class_Transform3D_property_basis>` is equal to :ref:`Basis.FLIP_Z<class_Basis_constant_FLIP_Z>`.
  135. .. rst-class:: classref-section-separator
  136. ----
  137. .. rst-class:: classref-descriptions-group
  138. Property Descriptions
  139. ---------------------
  140. .. _class_Transform3D_property_basis:
  141. .. rst-class:: classref-property
  142. :ref:`Basis<class_Basis>` **basis** = ``Basis(1, 0, 0, 0, 1, 0, 0, 0, 1)`` :ref:`🔗<class_Transform3D_property_basis>`
  143. The :ref:`Basis<class_Basis>` of this transform. It is composed by 3 axes (:ref:`Basis.x<class_Basis_property_x>`, :ref:`Basis.y<class_Basis_property_y>`, and :ref:`Basis.z<class_Basis_property_z>`). Together, these represent the transform's rotation, scale, and shear.
  144. .. rst-class:: classref-item-separator
  145. ----
  146. .. _class_Transform3D_property_origin:
  147. .. rst-class:: classref-property
  148. :ref:`Vector3<class_Vector3>` **origin** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_Transform3D_property_origin>`
  149. The translation offset of this transform. In 3D space, this can be seen as the position.
  150. .. rst-class:: classref-section-separator
  151. ----
  152. .. rst-class:: classref-descriptions-group
  153. Constructor Descriptions
  154. ------------------------
  155. .. _class_Transform3D_constructor_Transform3D:
  156. .. rst-class:: classref-constructor
  157. :ref:`Transform3D<class_Transform3D>` **Transform3D**\ (\ ) :ref:`🔗<class_Transform3D_constructor_Transform3D>`
  158. Constructs a **Transform3D** identical to the :ref:`IDENTITY<class_Transform3D_constant_IDENTITY>`.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. rst-class:: classref-constructor
  162. :ref:`Transform3D<class_Transform3D>` **Transform3D**\ (\ from\: :ref:`Transform3D<class_Transform3D>`\ )
  163. Constructs a **Transform3D** as a copy of the given **Transform3D**.
  164. .. rst-class:: classref-item-separator
  165. ----
  166. .. rst-class:: classref-constructor
  167. :ref:`Transform3D<class_Transform3D>` **Transform3D**\ (\ basis\: :ref:`Basis<class_Basis>`, origin\: :ref:`Vector3<class_Vector3>`\ )
  168. Constructs a **Transform3D** from a :ref:`Basis<class_Basis>` and :ref:`Vector3<class_Vector3>`.
  169. .. rst-class:: classref-item-separator
  170. ----
  171. .. rst-class:: classref-constructor
  172. :ref:`Transform3D<class_Transform3D>` **Transform3D**\ (\ from\: :ref:`Projection<class_Projection>`\ )
  173. Constructs a **Transform3D** from a :ref:`Projection<class_Projection>`. Because **Transform3D** is a 3×4 matrix and :ref:`Projection<class_Projection>` is a 4×4 matrix, this operation trims the last row of the projection matrix (``from.x.w``, ``from.y.w``, ``from.z.w``, and ``from.w.w`` are not included in the new transform).
  174. .. rst-class:: classref-item-separator
  175. ----
  176. .. rst-class:: classref-constructor
  177. :ref:`Transform3D<class_Transform3D>` **Transform3D**\ (\ x_axis\: :ref:`Vector3<class_Vector3>`, y_axis\: :ref:`Vector3<class_Vector3>`, z_axis\: :ref:`Vector3<class_Vector3>`, origin\: :ref:`Vector3<class_Vector3>`\ )
  178. Constructs a **Transform3D** from four :ref:`Vector3<class_Vector3>` values (also called matrix columns).
  179. The first three arguments are the :ref:`basis<class_Transform3D_property_basis>`'s axes (:ref:`Basis.x<class_Basis_property_x>`, :ref:`Basis.y<class_Basis_property_y>`, and :ref:`Basis.z<class_Basis_property_z>`).
  180. .. rst-class:: classref-section-separator
  181. ----
  182. .. rst-class:: classref-descriptions-group
  183. Method Descriptions
  184. -------------------
  185. .. _class_Transform3D_method_affine_inverse:
  186. .. rst-class:: classref-method
  187. :ref:`Transform3D<class_Transform3D>` **affine_inverse**\ (\ ) |const| :ref:`🔗<class_Transform3D_method_affine_inverse>`
  188. Returns the inverted version of this transform. Unlike :ref:`inverse<class_Transform3D_method_inverse>`, this method works with almost any :ref:`basis<class_Transform3D_property_basis>`, including non-uniform ones, but is slower. See also :ref:`Basis.inverse<class_Basis_method_inverse>`.
  189. \ **Note:** For this method to return correctly, the transform's :ref:`basis<class_Transform3D_property_basis>` needs to have a determinant that is not exactly ``0`` (see :ref:`Basis.determinant<class_Basis_method_determinant>`).
  190. .. rst-class:: classref-item-separator
  191. ----
  192. .. _class_Transform3D_method_interpolate_with:
  193. .. rst-class:: classref-method
  194. :ref:`Transform3D<class_Transform3D>` **interpolate_with**\ (\ xform\: :ref:`Transform3D<class_Transform3D>`, weight\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Transform3D_method_interpolate_with>`
  195. Returns the result of the linear interpolation between this transform and ``xform`` by the given ``weight``.
  196. The ``weight`` should be between ``0.0`` and ``1.0`` (inclusive). Values outside this range are allowed and can be used to perform *extrapolation* instead.
  197. .. rst-class:: classref-item-separator
  198. ----
  199. .. _class_Transform3D_method_inverse:
  200. .. rst-class:: classref-method
  201. :ref:`Transform3D<class_Transform3D>` **inverse**\ (\ ) |const| :ref:`🔗<class_Transform3D_method_inverse>`
  202. Returns the inverted version of this transform. See also :ref:`Basis.inverse<class_Basis_method_inverse>`.
  203. \ **Note:** For this method to return correctly, the transform's :ref:`basis<class_Transform3D_property_basis>` needs to be *orthonormal* (see :ref:`Basis.orthonormalized<class_Basis_method_orthonormalized>`). That means, the basis should only represent a rotation. If it does not, use :ref:`affine_inverse<class_Transform3D_method_affine_inverse>` instead.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_Transform3D_method_is_equal_approx:
  207. .. rst-class:: classref-method
  208. :ref:`bool<class_bool>` **is_equal_approx**\ (\ xform\: :ref:`Transform3D<class_Transform3D>`\ ) |const| :ref:`🔗<class_Transform3D_method_is_equal_approx>`
  209. Returns ``true`` if this transform and ``xform`` are approximately equal, by running :ref:`@GlobalScope.is_equal_approx<class_@GlobalScope_method_is_equal_approx>` on each component.
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_Transform3D_method_is_finite:
  213. .. rst-class:: classref-method
  214. :ref:`bool<class_bool>` **is_finite**\ (\ ) |const| :ref:`🔗<class_Transform3D_method_is_finite>`
  215. Returns ``true`` if this transform is finite, by calling :ref:`@GlobalScope.is_finite<class_@GlobalScope_method_is_finite>` on each component.
  216. .. rst-class:: classref-item-separator
  217. ----
  218. .. _class_Transform3D_method_looking_at:
  219. .. rst-class:: classref-method
  220. :ref:`Transform3D<class_Transform3D>` **looking_at**\ (\ target\: :ref:`Vector3<class_Vector3>`, up\: :ref:`Vector3<class_Vector3>` = Vector3(0, 1, 0), use_model_front\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Transform3D_method_looking_at>`
  221. Returns a copy of this transform rotated so that the forward axis (-Z) points towards the ``target`` position.
  222. The up axis (+Y) points as close to the ``up`` vector as possible while staying perpendicular to the forward axis. The resulting transform is orthonormalized. The existing rotation, scale, and skew information from the original transform is discarded. The ``target`` and ``up`` vectors cannot be zero, cannot be parallel to each other, and are defined in global/parent space.
  223. If ``use_model_front`` is ``true``, the +Z axis (asset front) is treated as forward (implies +X is left) and points toward the ``target`` position. By default, the -Z axis (camera forward) is treated as forward (implies +X is right).
  224. .. rst-class:: classref-item-separator
  225. ----
  226. .. _class_Transform3D_method_orthonormalized:
  227. .. rst-class:: classref-method
  228. :ref:`Transform3D<class_Transform3D>` **orthonormalized**\ (\ ) |const| :ref:`🔗<class_Transform3D_method_orthonormalized>`
  229. Returns a copy of this transform with its :ref:`basis<class_Transform3D_property_basis>` orthonormalized. An orthonormal basis is both *orthogonal* (the axes are perpendicular to each other) and *normalized* (the axes have a length of ``1``), which also means it can only represent rotation. See also :ref:`Basis.orthonormalized<class_Basis_method_orthonormalized>`.
  230. .. rst-class:: classref-item-separator
  231. ----
  232. .. _class_Transform3D_method_rotated:
  233. .. rst-class:: classref-method
  234. :ref:`Transform3D<class_Transform3D>` **rotated**\ (\ axis\: :ref:`Vector3<class_Vector3>`, angle\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Transform3D_method_rotated>`
  235. Returns a copy of this transform rotated around the given ``axis`` by the given ``angle`` (in radians).
  236. The ``axis`` must be a normalized vector.
  237. This method is an optimized version of multiplying the given transform ``X`` with a corresponding rotation transform ``R`` from the left, i.e., ``R * X``.
  238. This can be seen as transforming with respect to the global/parent frame.
  239. .. rst-class:: classref-item-separator
  240. ----
  241. .. _class_Transform3D_method_rotated_local:
  242. .. rst-class:: classref-method
  243. :ref:`Transform3D<class_Transform3D>` **rotated_local**\ (\ axis\: :ref:`Vector3<class_Vector3>`, angle\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Transform3D_method_rotated_local>`
  244. Returns a copy of this transform rotated around the given ``axis`` by the given ``angle`` (in radians).
  245. The ``axis`` must be a normalized vector.
  246. This method is an optimized version of multiplying the given transform ``X`` with a corresponding rotation transform ``R`` from the right, i.e., ``X * R``.
  247. This can be seen as transforming with respect to the local frame.
  248. .. rst-class:: classref-item-separator
  249. ----
  250. .. _class_Transform3D_method_scaled:
  251. .. rst-class:: classref-method
  252. :ref:`Transform3D<class_Transform3D>` **scaled**\ (\ scale\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Transform3D_method_scaled>`
  253. Returns a copy of this transform scaled by the given ``scale`` factor.
  254. This method is an optimized version of multiplying the given transform ``X`` with a corresponding scaling transform ``S`` from the left, i.e., ``S * X``.
  255. This can be seen as transforming with respect to the global/parent frame.
  256. .. rst-class:: classref-item-separator
  257. ----
  258. .. _class_Transform3D_method_scaled_local:
  259. .. rst-class:: classref-method
  260. :ref:`Transform3D<class_Transform3D>` **scaled_local**\ (\ scale\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Transform3D_method_scaled_local>`
  261. Returns a copy of this transform scaled by the given ``scale`` factor.
  262. This method is an optimized version of multiplying the given transform ``X`` with a corresponding scaling transform ``S`` from the right, i.e., ``X * S``.
  263. This can be seen as transforming with respect to the local frame.
  264. .. rst-class:: classref-item-separator
  265. ----
  266. .. _class_Transform3D_method_translated:
  267. .. rst-class:: classref-method
  268. :ref:`Transform3D<class_Transform3D>` **translated**\ (\ offset\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Transform3D_method_translated>`
  269. Returns a copy of this transform translated by the given ``offset``.
  270. This method is an optimized version of multiplying the given transform ``X`` with a corresponding translation transform ``T`` from the left, i.e., ``T * X``.
  271. This can be seen as transforming with respect to the global/parent frame.
  272. .. rst-class:: classref-item-separator
  273. ----
  274. .. _class_Transform3D_method_translated_local:
  275. .. rst-class:: classref-method
  276. :ref:`Transform3D<class_Transform3D>` **translated_local**\ (\ offset\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Transform3D_method_translated_local>`
  277. Returns a copy of this transform translated by the given ``offset``.
  278. This method is an optimized version of multiplying the given transform ``X`` with a corresponding translation transform ``T`` from the right, i.e., ``X * T``.
  279. This can be seen as transforming with respect to the local frame.
  280. .. rst-class:: classref-section-separator
  281. ----
  282. .. rst-class:: classref-descriptions-group
  283. Operator Descriptions
  284. ---------------------
  285. .. _class_Transform3D_operator_neq_Transform3D:
  286. .. rst-class:: classref-operator
  287. :ref:`bool<class_bool>` **operator !=**\ (\ right\: :ref:`Transform3D<class_Transform3D>`\ ) :ref:`🔗<class_Transform3D_operator_neq_Transform3D>`
  288. Returns ``true`` if the components of both transforms are not equal.
  289. \ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx<class_Transform3D_method_is_equal_approx>` instead, which is more reliable.
  290. .. rst-class:: classref-item-separator
  291. ----
  292. .. _class_Transform3D_operator_mul_AABB:
  293. .. rst-class:: classref-operator
  294. :ref:`AABB<class_AABB>` **operator ***\ (\ right\: :ref:`AABB<class_AABB>`\ ) :ref:`🔗<class_Transform3D_operator_mul_AABB>`
  295. Transforms (multiplies) the :ref:`AABB<class_AABB>` by this transformation matrix.
  296. .. rst-class:: classref-item-separator
  297. ----
  298. .. _class_Transform3D_operator_mul_PackedVector3Array:
  299. .. rst-class:: classref-operator
  300. :ref:`PackedVector3Array<class_PackedVector3Array>` **operator ***\ (\ right\: :ref:`PackedVector3Array<class_PackedVector3Array>`\ ) :ref:`🔗<class_Transform3D_operator_mul_PackedVector3Array>`
  301. Transforms (multiplies) every :ref:`Vector3<class_Vector3>` element of the given :ref:`PackedVector3Array<class_PackedVector3Array>` by this transformation matrix.
  302. On larger arrays, this operation is much faster than transforming each :ref:`Vector3<class_Vector3>` individually.
  303. .. rst-class:: classref-item-separator
  304. ----
  305. .. _class_Transform3D_operator_mul_Plane:
  306. .. rst-class:: classref-operator
  307. :ref:`Plane<class_Plane>` **operator ***\ (\ right\: :ref:`Plane<class_Plane>`\ ) :ref:`🔗<class_Transform3D_operator_mul_Plane>`
  308. Transforms (multiplies) the :ref:`Plane<class_Plane>` by this transformation matrix.
  309. .. rst-class:: classref-item-separator
  310. ----
  311. .. _class_Transform3D_operator_mul_Transform3D:
  312. .. rst-class:: classref-operator
  313. :ref:`Transform3D<class_Transform3D>` **operator ***\ (\ right\: :ref:`Transform3D<class_Transform3D>`\ ) :ref:`🔗<class_Transform3D_operator_mul_Transform3D>`
  314. Transforms (multiplies) this transform by the ``right`` transform.
  315. This is the operation performed between parent and child :ref:`Node3D<class_Node3D>`\ s.
  316. \ **Note:** If you need to only modify one attribute of this transform, consider using one of the following methods, instead:
  317. - For translation, see :ref:`translated<class_Transform3D_method_translated>` or :ref:`translated_local<class_Transform3D_method_translated_local>`.
  318. - For rotation, see :ref:`rotated<class_Transform3D_method_rotated>` or :ref:`rotated_local<class_Transform3D_method_rotated_local>`.
  319. - For scale, see :ref:`scaled<class_Transform3D_method_scaled>` or :ref:`scaled_local<class_Transform3D_method_scaled_local>`.
  320. .. rst-class:: classref-item-separator
  321. ----
  322. .. _class_Transform3D_operator_mul_Vector3:
  323. .. rst-class:: classref-operator
  324. :ref:`Vector3<class_Vector3>` **operator ***\ (\ right\: :ref:`Vector3<class_Vector3>`\ ) :ref:`🔗<class_Transform3D_operator_mul_Vector3>`
  325. Transforms (multiplies) the :ref:`Vector3<class_Vector3>` by this transformation matrix.
  326. .. rst-class:: classref-item-separator
  327. ----
  328. .. _class_Transform3D_operator_mul_float:
  329. .. rst-class:: classref-operator
  330. :ref:`Transform3D<class_Transform3D>` **operator ***\ (\ right\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Transform3D_operator_mul_float>`
  331. Multiplies all components of the **Transform3D** by the given :ref:`float<class_float>`, including the :ref:`origin<class_Transform3D_property_origin>`. This affects the transform's scale uniformly, scaling the :ref:`basis<class_Transform3D_property_basis>`.
  332. .. rst-class:: classref-item-separator
  333. ----
  334. .. _class_Transform3D_operator_mul_int:
  335. .. rst-class:: classref-operator
  336. :ref:`Transform3D<class_Transform3D>` **operator ***\ (\ right\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Transform3D_operator_mul_int>`
  337. Multiplies all components of the **Transform3D** by the given :ref:`int<class_int>`, including the :ref:`origin<class_Transform3D_property_origin>`. This affects the transform's scale uniformly, scaling the :ref:`basis<class_Transform3D_property_basis>`.
  338. .. rst-class:: classref-item-separator
  339. ----
  340. .. _class_Transform3D_operator_div_float:
  341. .. rst-class:: classref-operator
  342. :ref:`Transform3D<class_Transform3D>` **operator /**\ (\ right\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Transform3D_operator_div_float>`
  343. Divides all components of the **Transform3D** by the given :ref:`float<class_float>`, including the :ref:`origin<class_Transform3D_property_origin>`. This affects the transform's scale uniformly, scaling the :ref:`basis<class_Transform3D_property_basis>`.
  344. .. rst-class:: classref-item-separator
  345. ----
  346. .. _class_Transform3D_operator_div_int:
  347. .. rst-class:: classref-operator
  348. :ref:`Transform3D<class_Transform3D>` **operator /**\ (\ right\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Transform3D_operator_div_int>`
  349. Divides all components of the **Transform3D** by the given :ref:`int<class_int>`, including the :ref:`origin<class_Transform3D_property_origin>`. This affects the transform's scale uniformly, scaling the :ref:`basis<class_Transform3D_property_basis>`.
  350. .. rst-class:: classref-item-separator
  351. ----
  352. .. _class_Transform3D_operator_eq_Transform3D:
  353. .. rst-class:: classref-operator
  354. :ref:`bool<class_bool>` **operator ==**\ (\ right\: :ref:`Transform3D<class_Transform3D>`\ ) :ref:`🔗<class_Transform3D_operator_eq_Transform3D>`
  355. Returns ``true`` if the components of both transforms are exactly equal.
  356. \ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx<class_Transform3D_method_is_equal_approx>` instead, which is more reliable.
  357. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  358. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  359. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  360. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  361. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  362. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  363. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  364. .. |void| replace:: :abbr:`void (No return value.)`