class_transform3d.rst 33 KB

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