class_transform3d.rst 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  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.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/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 `Importing 3D Scenes <../tutorials/assets_pipeline/importing_scenes.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/584>`__
  25. - `3D Platformer Demo <https://godotengine.org/asset-library/asset/125>`__
  26. - `2.5D Demo <https://godotengine.org/asset-library/asset/583>`__
  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>` **(** :ref:`Transform3D<class_Transform3D>` from **)** |
  46. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`Transform3D<class_Transform3D>` | :ref:`Transform3D<class_Transform3D_constructor_Transform3D>` **(** :ref:`Basis<class_Basis>` basis, :ref:`Vector3<class_Vector3>` origin **)** |
  48. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Transform3D<class_Transform3D>` | :ref:`Transform3D<class_Transform3D_constructor_Transform3D>` **(** :ref:`Projection<class_Projection>` from **)** |
  50. +---------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`Transform3D<class_Transform3D>` | :ref:`Transform3D<class_Transform3D_constructor_Transform3D>` **(** :ref:`Vector3<class_Vector3>` x_axis, :ref:`Vector3<class_Vector3>` y_axis, :ref:`Vector3<class_Vector3>` z_axis, :ref:`Vector3<class_Vector3>` origin **)** |
  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>` **(** :ref:`Transform3D<class_Transform3D>` xform, :ref:`float<class_float>` weight **)** |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>` **(** :ref:`Transform3D<class_Transform3D>` xform **)** |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>` **(** :ref:`Vector3<class_Vector3>` target, :ref:`Vector3<class_Vector3>` up=Vector3(0, 1, 0), :ref:`bool<class_bool>` use_model_front=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>` **(** :ref:`Vector3<class_Vector3>` axis, :ref:`float<class_float>` angle **)** |const| |
  74. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`Transform3D<class_Transform3D>` | :ref:`rotated_local<class_Transform3D_method_rotated_local>` **(** :ref:`Vector3<class_Vector3>` axis, :ref:`float<class_float>` angle **)** |const| |
  76. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`Transform3D<class_Transform3D>` | :ref:`scaled<class_Transform3D_method_scaled>` **(** :ref:`Vector3<class_Vector3>` scale **)** |const| |
  78. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`Transform3D<class_Transform3D>` | :ref:`scaled_local<class_Transform3D_method_scaled_local>` **(** :ref:`Vector3<class_Vector3>` scale **)** |const| |
  80. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`Transform3D<class_Transform3D>` | :ref:`translated<class_Transform3D_method_translated>` **(** :ref:`Vector3<class_Vector3>` offset **)** |const| |
  82. +---------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`Transform3D<class_Transform3D>` | :ref:`translated_local<class_Transform3D_method_translated_local>` **(** :ref:`Vector3<class_Vector3>` offset **)** |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>` **(** :ref:`Transform3D<class_Transform3D>` right **)** |
  92. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`AABB<class_AABB>` | :ref:`operator *<class_Transform3D_operator_mul_AABB>` **(** :ref:`AABB<class_AABB>` right **)** |
  94. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`operator *<class_Transform3D_operator_mul_PackedVector3Array>` **(** :ref:`PackedVector3Array<class_PackedVector3Array>` right **)** |
  96. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`Plane<class_Plane>` | :ref:`operator *<class_Transform3D_operator_mul_Plane>` **(** :ref:`Plane<class_Plane>` right **)** |
  98. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  99. | :ref:`Transform3D<class_Transform3D>` | :ref:`operator *<class_Transform3D_operator_mul_Transform3D>` **(** :ref:`Transform3D<class_Transform3D>` right **)** |
  100. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`Vector3<class_Vector3>` | :ref:`operator *<class_Transform3D_operator_mul_Vector3>` **(** :ref:`Vector3<class_Vector3>` right **)** |
  102. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`Transform3D<class_Transform3D>` | :ref:`operator *<class_Transform3D_operator_mul_float>` **(** :ref:`float<class_float>` right **)** |
  104. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`Transform3D<class_Transform3D>` | :ref:`operator *<class_Transform3D_operator_mul_int>` **(** :ref:`int<class_int>` right **)** |
  106. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`bool<class_bool>` | :ref:`operator ==<class_Transform3D_operator_eq_Transform3D>` **(** :ref:`Transform3D<class_Transform3D>` right **)** |
  108. +-----------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
  109. .. rst-class:: classref-section-separator
  110. ----
  111. .. rst-class:: classref-descriptions-group
  112. Constants
  113. ---------
  114. .. _class_Transform3D_constant_IDENTITY:
  115. .. rst-class:: classref-constant
  116. **IDENTITY** = ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)``
  117. 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>`.
  118. When multiplied by another :ref:`Variant<class_Variant>` such as :ref:`AABB<class_AABB>` or another **Transform3D**, no transformation occurs.
  119. .. _class_Transform3D_constant_FLIP_X:
  120. .. rst-class:: classref-constant
  121. **FLIP_X** = ``Transform3D(-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)``
  122. **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>`.
  123. .. _class_Transform3D_constant_FLIP_Y:
  124. .. rst-class:: classref-constant
  125. **FLIP_Y** = ``Transform3D(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0)``
  126. **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>`.
  127. .. _class_Transform3D_constant_FLIP_Z:
  128. .. rst-class:: classref-constant
  129. **FLIP_Z** = ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0)``
  130. **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>`.
  131. .. rst-class:: classref-section-separator
  132. ----
  133. .. rst-class:: classref-descriptions-group
  134. Property Descriptions
  135. ---------------------
  136. .. _class_Transform3D_property_basis:
  137. .. rst-class:: classref-property
  138. :ref:`Basis<class_Basis>` **basis** = ``Basis(1, 0, 0, 0, 1, 0, 0, 0, 1)``
  139. 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.
  140. .. rst-class:: classref-item-separator
  141. ----
  142. .. _class_Transform3D_property_origin:
  143. .. rst-class:: classref-property
  144. :ref:`Vector3<class_Vector3>` **origin** = ``Vector3(0, 0, 0)``
  145. The translation offset of this transform. In 3D space, this can be seen as the position.
  146. .. rst-class:: classref-section-separator
  147. ----
  148. .. rst-class:: classref-descriptions-group
  149. Constructor Descriptions
  150. ------------------------
  151. .. _class_Transform3D_constructor_Transform3D:
  152. .. rst-class:: classref-constructor
  153. :ref:`Transform3D<class_Transform3D>` **Transform3D** **(** **)**
  154. Constructs a **Transform3D** identical to the :ref:`IDENTITY<class_Transform3D_constant_IDENTITY>`.
  155. .. rst-class:: classref-item-separator
  156. ----
  157. .. rst-class:: classref-constructor
  158. :ref:`Transform3D<class_Transform3D>` **Transform3D** **(** :ref:`Transform3D<class_Transform3D>` from **)**
  159. Constructs a **Transform3D** as a copy of the given **Transform3D**.
  160. .. rst-class:: classref-item-separator
  161. ----
  162. .. rst-class:: classref-constructor
  163. :ref:`Transform3D<class_Transform3D>` **Transform3D** **(** :ref:`Basis<class_Basis>` basis, :ref:`Vector3<class_Vector3>` origin **)**
  164. Constructs a **Transform3D** from a :ref:`Basis<class_Basis>` and :ref:`Vector3<class_Vector3>`.
  165. .. rst-class:: classref-item-separator
  166. ----
  167. .. rst-class:: classref-constructor
  168. :ref:`Transform3D<class_Transform3D>` **Transform3D** **(** :ref:`Projection<class_Projection>` from **)**
  169. 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).
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. rst-class:: classref-constructor
  173. :ref:`Transform3D<class_Transform3D>` **Transform3D** **(** :ref:`Vector3<class_Vector3>` x_axis, :ref:`Vector3<class_Vector3>` y_axis, :ref:`Vector3<class_Vector3>` z_axis, :ref:`Vector3<class_Vector3>` origin **)**
  174. Constructs a **Transform3D** from four :ref:`Vector3<class_Vector3>` values (also called matrix columns).
  175. 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>`).
  176. .. rst-class:: classref-section-separator
  177. ----
  178. .. rst-class:: classref-descriptions-group
  179. Method Descriptions
  180. -------------------
  181. .. _class_Transform3D_method_affine_inverse:
  182. .. rst-class:: classref-method
  183. :ref:`Transform3D<class_Transform3D>` **affine_inverse** **(** **)** |const|
  184. 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>`.
  185. \ **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>`).
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_Transform3D_method_interpolate_with:
  189. .. rst-class:: classref-method
  190. :ref:`Transform3D<class_Transform3D>` **interpolate_with** **(** :ref:`Transform3D<class_Transform3D>` xform, :ref:`float<class_float>` weight **)** |const|
  191. Returns the result of the linear interpolation between this transform and ``xform`` by the given ``weight``.
  192. 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.
  193. .. rst-class:: classref-item-separator
  194. ----
  195. .. _class_Transform3D_method_inverse:
  196. .. rst-class:: classref-method
  197. :ref:`Transform3D<class_Transform3D>` **inverse** **(** **)** |const|
  198. Returns the inverted version of this transform. See also :ref:`Basis.inverse<class_Basis_method_inverse>`.
  199. \ **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.
  200. .. rst-class:: classref-item-separator
  201. ----
  202. .. _class_Transform3D_method_is_equal_approx:
  203. .. rst-class:: classref-method
  204. :ref:`bool<class_bool>` **is_equal_approx** **(** :ref:`Transform3D<class_Transform3D>` xform **)** |const|
  205. 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.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_Transform3D_method_is_finite:
  209. .. rst-class:: classref-method
  210. :ref:`bool<class_bool>` **is_finite** **(** **)** |const|
  211. Returns ``true`` if this transform is finite, by calling :ref:`@GlobalScope.is_finite<class_@GlobalScope_method_is_finite>` on each component.
  212. .. rst-class:: classref-item-separator
  213. ----
  214. .. _class_Transform3D_method_looking_at:
  215. .. rst-class:: classref-method
  216. :ref:`Transform3D<class_Transform3D>` **looking_at** **(** :ref:`Vector3<class_Vector3>` target, :ref:`Vector3<class_Vector3>` up=Vector3(0, 1, 0), :ref:`bool<class_bool>` use_model_front=false **)** |const|
  217. Returns a copy of this transform rotated so that the forward axis (-Z) points towards the ``target`` position.
  218. 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.
  219. 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).
  220. .. rst-class:: classref-item-separator
  221. ----
  222. .. _class_Transform3D_method_orthonormalized:
  223. .. rst-class:: classref-method
  224. :ref:`Transform3D<class_Transform3D>` **orthonormalized** **(** **)** |const|
  225. 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>`.
  226. .. rst-class:: classref-item-separator
  227. ----
  228. .. _class_Transform3D_method_rotated:
  229. .. rst-class:: classref-method
  230. :ref:`Transform3D<class_Transform3D>` **rotated** **(** :ref:`Vector3<class_Vector3>` axis, :ref:`float<class_float>` angle **)** |const|
  231. Returns a copy of this transform rotated around the given ``axis`` by the given ``angle`` (in radians).
  232. The ``axis`` must be a normalized vector.
  233. 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``.
  234. This can be seen as transforming with respect to the global/parent frame.
  235. .. rst-class:: classref-item-separator
  236. ----
  237. .. _class_Transform3D_method_rotated_local:
  238. .. rst-class:: classref-method
  239. :ref:`Transform3D<class_Transform3D>` **rotated_local** **(** :ref:`Vector3<class_Vector3>` axis, :ref:`float<class_float>` angle **)** |const|
  240. Returns a copy of this transform rotated around the given ``axis`` by the given ``angle`` (in radians).
  241. The ``axis`` must be a normalized vector.
  242. 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``.
  243. This can be seen as transforming with respect to the local frame.
  244. .. rst-class:: classref-item-separator
  245. ----
  246. .. _class_Transform3D_method_scaled:
  247. .. rst-class:: classref-method
  248. :ref:`Transform3D<class_Transform3D>` **scaled** **(** :ref:`Vector3<class_Vector3>` scale **)** |const|
  249. Returns a copy of this transform scaled by the given ``scale`` factor.
  250. 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``.
  251. This can be seen as transforming with respect to the global/parent frame.
  252. .. rst-class:: classref-item-separator
  253. ----
  254. .. _class_Transform3D_method_scaled_local:
  255. .. rst-class:: classref-method
  256. :ref:`Transform3D<class_Transform3D>` **scaled_local** **(** :ref:`Vector3<class_Vector3>` scale **)** |const|
  257. Returns a copy of this transform scaled by the given ``scale`` factor.
  258. 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``.
  259. This can be seen as transforming with respect to the local frame.
  260. .. rst-class:: classref-item-separator
  261. ----
  262. .. _class_Transform3D_method_translated:
  263. .. rst-class:: classref-method
  264. :ref:`Transform3D<class_Transform3D>` **translated** **(** :ref:`Vector3<class_Vector3>` offset **)** |const|
  265. Returns a copy of this transform translated by the given ``offset``.
  266. 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``.
  267. This can be seen as transforming with respect to the global/parent frame.
  268. .. rst-class:: classref-item-separator
  269. ----
  270. .. _class_Transform3D_method_translated_local:
  271. .. rst-class:: classref-method
  272. :ref:`Transform3D<class_Transform3D>` **translated_local** **(** :ref:`Vector3<class_Vector3>` offset **)** |const|
  273. Returns a copy of this transform translated by the given ``offset``.
  274. 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``.
  275. This can be seen as transforming with respect to the local frame.
  276. .. rst-class:: classref-section-separator
  277. ----
  278. .. rst-class:: classref-descriptions-group
  279. Operator Descriptions
  280. ---------------------
  281. .. _class_Transform3D_operator_neq_Transform3D:
  282. .. rst-class:: classref-operator
  283. :ref:`bool<class_bool>` **operator !=** **(** :ref:`Transform3D<class_Transform3D>` right **)**
  284. Returns ``true`` if the components of both transforms are not equal.
  285. \ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx<class_Transform3D_method_is_equal_approx>` instead, which is more reliable.
  286. .. rst-class:: classref-item-separator
  287. ----
  288. .. _class_Transform3D_operator_mul_AABB:
  289. .. rst-class:: classref-operator
  290. :ref:`AABB<class_AABB>` **operator *** **(** :ref:`AABB<class_AABB>` right **)**
  291. Transforms (multiplies) the :ref:`AABB<class_AABB>` by this transformation matrix.
  292. .. rst-class:: classref-item-separator
  293. ----
  294. .. _class_Transform3D_operator_mul_PackedVector3Array:
  295. .. rst-class:: classref-operator
  296. :ref:`PackedVector3Array<class_PackedVector3Array>` **operator *** **(** :ref:`PackedVector3Array<class_PackedVector3Array>` right **)**
  297. Transforms (multiplies) every :ref:`Vector3<class_Vector3>` element of the given :ref:`PackedVector3Array<class_PackedVector3Array>` by this transformation matrix.
  298. On larger arrays, this operation is much faster than transforming each :ref:`Vector3<class_Vector3>` individually.
  299. .. rst-class:: classref-item-separator
  300. ----
  301. .. _class_Transform3D_operator_mul_Plane:
  302. .. rst-class:: classref-operator
  303. :ref:`Plane<class_Plane>` **operator *** **(** :ref:`Plane<class_Plane>` right **)**
  304. Transforms (multiplies) the :ref:`Plane<class_Plane>` by this transformation matrix.
  305. .. rst-class:: classref-item-separator
  306. ----
  307. .. _class_Transform3D_operator_mul_Transform3D:
  308. .. rst-class:: classref-operator
  309. :ref:`Transform3D<class_Transform3D>` **operator *** **(** :ref:`Transform3D<class_Transform3D>` right **)**
  310. Transforms (multiplies) this transform by the ``right`` transform.
  311. This is the operation performed between parent and child :ref:`Node3D<class_Node3D>`\ s.
  312. \ **Note:** If you need to only modify one attribute of this transform, consider using one of the following methods, instead:
  313. - For translation, see :ref:`translated<class_Transform3D_method_translated>` or :ref:`translated_local<class_Transform3D_method_translated_local>`.
  314. - For rotation, see :ref:`rotated<class_Transform3D_method_rotated>` or :ref:`rotated_local<class_Transform3D_method_rotated_local>`.
  315. - For scale, see :ref:`scaled<class_Transform3D_method_scaled>` or :ref:`scaled_local<class_Transform3D_method_scaled_local>`.
  316. .. rst-class:: classref-item-separator
  317. ----
  318. .. _class_Transform3D_operator_mul_Vector3:
  319. .. rst-class:: classref-operator
  320. :ref:`Vector3<class_Vector3>` **operator *** **(** :ref:`Vector3<class_Vector3>` right **)**
  321. Transforms (multiplies) the :ref:`Vector3<class_Vector3>` by this transformation matrix.
  322. .. rst-class:: classref-item-separator
  323. ----
  324. .. _class_Transform3D_operator_mul_float:
  325. .. rst-class:: classref-operator
  326. :ref:`Transform3D<class_Transform3D>` **operator *** **(** :ref:`float<class_float>` right **)**
  327. 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>`.
  328. .. rst-class:: classref-item-separator
  329. ----
  330. .. _class_Transform3D_operator_mul_int:
  331. .. rst-class:: classref-operator
  332. :ref:`Transform3D<class_Transform3D>` **operator *** **(** :ref:`int<class_int>` right **)**
  333. 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>`.
  334. .. rst-class:: classref-item-separator
  335. ----
  336. .. _class_Transform3D_operator_eq_Transform3D:
  337. .. rst-class:: classref-operator
  338. :ref:`bool<class_bool>` **operator ==** **(** :ref:`Transform3D<class_Transform3D>` right **)**
  339. Returns ``true`` if the components of both transforms are exactly equal.
  340. \ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx<class_Transform3D_method_is_equal_approx>` instead, which is more reliable.
  341. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  342. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  343. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  344. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  345. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  346. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  347. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`