Transform3D.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Transform3D" version="4.0">
  3. <brief_description>
  4. 3D transformation (3×4 matrix).
  5. </brief_description>
  6. <description>
  7. 3×4 matrix (3 rows, 4 columns) used for 3D linear transformations. It can represent transformations such as translation, rotation, or scaling. It consists of a [member basis] (first 3 columns) and a [Vector3] for the [member origin] (last column).
  8. For more information, read the "Matrices and transforms" documentation article.
  9. </description>
  10. <tutorials>
  11. <link title="Math documentation index">https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>
  12. <link title="Matrices and transforms">https://docs.godotengine.org/en/latest/tutorials/math/matrices_and_transforms.html</link>
  13. <link title="Using 3D transforms">https://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html</link>
  14. <link title="Matrix Transform Demo">https://godotengine.org/asset-library/asset/584</link>
  15. <link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/125</link>
  16. <link title="2.5D Demo">https://godotengine.org/asset-library/asset/583</link>
  17. </tutorials>
  18. <constructors>
  19. <constructor name="Transform3D">
  20. <return type="Transform3D" />
  21. <description>
  22. Constructs a default-initialized [Transform3D] set to [constant IDENTITY].
  23. </description>
  24. </constructor>
  25. <constructor name="Transform3D">
  26. <return type="Transform3D" />
  27. <argument index="0" name="from" type="Transform3D" />
  28. <description>
  29. Constructs a [Transform3D] as a copy of the given [Transform3D].
  30. </description>
  31. </constructor>
  32. <constructor name="Transform3D">
  33. <return type="Transform3D" />
  34. <argument index="0" name="basis" type="Basis" />
  35. <argument index="1" name="origin" type="Vector3" />
  36. <description>
  37. Constructs a Transform3D from a [Basis] and [Vector3].
  38. </description>
  39. </constructor>
  40. <constructor name="Transform3D">
  41. <return type="Transform3D" />
  42. <argument index="0" name="x_axis" type="Vector3" />
  43. <argument index="1" name="y_axis" type="Vector3" />
  44. <argument index="2" name="z_axis" type="Vector3" />
  45. <argument index="3" name="origin" type="Vector3" />
  46. <description>
  47. Constructs a Transform3D from four [Vector3] values (matrix columns). Each axis corresponds to local basis vectors (some of which may be scaled).
  48. </description>
  49. </constructor>
  50. </constructors>
  51. <methods>
  52. <method name="affine_inverse" qualifiers="const">
  53. <return type="Transform3D" />
  54. <description>
  55. Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.
  56. </description>
  57. </method>
  58. <method name="interpolate_with" qualifiers="const">
  59. <return type="Transform3D" />
  60. <argument index="0" name="xform" type="Transform3D" />
  61. <argument index="1" name="weight" type="float" />
  62. <description>
  63. Interpolates the transform to other Transform3D by weight amount (on the range of 0.0 to 1.0).
  64. </description>
  65. </method>
  66. <method name="inverse" qualifiers="const">
  67. <return type="Transform3D" />
  68. <description>
  69. Returns the inverse of the transform, under the assumption that the transformation is composed of rotation and translation (no scaling, use affine_inverse for transforms with scaling).
  70. </description>
  71. </method>
  72. <method name="is_equal_approx" qualifiers="const">
  73. <return type="bool" />
  74. <argument index="0" name="xform" type="Transform3D" />
  75. <description>
  76. Returns [code]true[/code] if this transform and [code]transform[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component.
  77. </description>
  78. </method>
  79. <method name="looking_at" qualifiers="const">
  80. <return type="Transform3D" />
  81. <argument index="0" name="target" type="Vector3" />
  82. <argument index="1" name="up" type="Vector3" default="Vector3(0, 1, 0)" />
  83. <description>
  84. Returns a copy of the transform rotated such that the forward axis (-Z) points towards the [code]target[/code] position.
  85. The up axis (+Y) points as close to the [code]up[/code] 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 [code]target[/code] and [code]up[/code] vectors cannot be zero, cannot be parallel to each other, and are defined in global/parent space.
  86. </description>
  87. </method>
  88. <method name="orthonormalized" qualifiers="const">
  89. <return type="Transform3D" />
  90. <description>
  91. Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors.
  92. </description>
  93. </method>
  94. <method name="rotated" qualifiers="const">
  95. <return type="Transform3D" />
  96. <argument index="0" name="axis" type="Vector3" />
  97. <argument index="1" name="phi" type="float" />
  98. <description>
  99. Rotates the transform around the given axis by the given angle (in radians), using matrix multiplication. The axis must be a normalized vector.
  100. </description>
  101. </method>
  102. <method name="scaled" qualifiers="const">
  103. <return type="Transform3D" />
  104. <argument index="0" name="scale" type="Vector3" />
  105. <description>
  106. Scales basis and origin of the transform by the given scale factor, using matrix multiplication.
  107. </description>
  108. </method>
  109. <method name="translated" qualifiers="const">
  110. <return type="Transform3D" />
  111. <argument index="0" name="offset" type="Vector3" />
  112. <description>
  113. Translates the transform by the given offset, relative to the transform's basis vectors.
  114. Unlike [method rotated] and [method scaled], this does not use matrix multiplication.
  115. </description>
  116. </method>
  117. </methods>
  118. <members>
  119. <member name="basis" type="Basis" setter="" getter="" default="Basis(1, 0, 0, 0, 1, 0, 0, 0, 1)">
  120. The basis is a matrix containing 3 [Vector3] as its columns: X axis, Y axis, and Z axis. These vectors can be interpreted as the basis vectors of local coordinate system traveling with the object.
  121. </member>
  122. <member name="origin" type="Vector3" setter="" getter="" default="Vector3(0, 0, 0)">
  123. The translation offset of the transform (column 3, the fourth column). Equivalent to array index [code]3[/code].
  124. </member>
  125. </members>
  126. <constants>
  127. <constant name="IDENTITY" value="Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)">
  128. [Transform3D] with no translation, rotation or scaling applied. When applied to other data structures, [constant IDENTITY] performs no transformation.
  129. </constant>
  130. <constant name="FLIP_X" value="Transform3D(-1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)">
  131. [Transform3D] with mirroring applied perpendicular to the YZ plane.
  132. </constant>
  133. <constant name="FLIP_Y" value="Transform3D(1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0)">
  134. [Transform3D] with mirroring applied perpendicular to the XZ plane.
  135. </constant>
  136. <constant name="FLIP_Z" value="Transform3D(1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0)">
  137. [Transform3D] with mirroring applied perpendicular to the XY plane.
  138. </constant>
  139. </constants>
  140. <operators>
  141. <operator name="operator !=">
  142. <return type="bool" />
  143. <description>
  144. </description>
  145. </operator>
  146. <operator name="operator !=">
  147. <return type="bool" />
  148. <argument index="0" name="right" type="Transform3D" />
  149. <description>
  150. </description>
  151. </operator>
  152. <operator name="operator *">
  153. <return type="PackedVector3Array" />
  154. <argument index="0" name="right" type="PackedVector3Array" />
  155. <description>
  156. </description>
  157. </operator>
  158. <operator name="operator *">
  159. <return type="Transform3D" />
  160. <argument index="0" name="right" type="Transform3D" />
  161. <description>
  162. </description>
  163. </operator>
  164. <operator name="operator *">
  165. <return type="AABB" />
  166. <argument index="0" name="right" type="AABB" />
  167. <description>
  168. </description>
  169. </operator>
  170. <operator name="operator *">
  171. <return type="Vector3" />
  172. <argument index="0" name="right" type="Vector3" />
  173. <description>
  174. </description>
  175. </operator>
  176. <operator name="operator *">
  177. <return type="Transform3D" />
  178. <argument index="0" name="right" type="float" />
  179. <description>
  180. This operator multiplies all components of the [Transform3D], including the origin vector, which scales it uniformly.
  181. </description>
  182. </operator>
  183. <operator name="operator *">
  184. <return type="Transform3D" />
  185. <argument index="0" name="right" type="int" />
  186. <description>
  187. This operator multiplies all components of the [Transform3D], including the origin vector, which scales it uniformly.
  188. </description>
  189. </operator>
  190. <operator name="operator ==">
  191. <return type="bool" />
  192. <description>
  193. </description>
  194. </operator>
  195. <operator name="operator ==">
  196. <return type="bool" />
  197. <argument index="0" name="right" type="Transform3D" />
  198. <description>
  199. </description>
  200. </operator>
  201. </operators>
  202. </class>