Transform.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Transform" version="3.4">
  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 tutorial index">https://docs.godotengine.org/en/3.3/tutorials/math/index.html</link>
  12. <link title="Matrices and transforms">https://docs.godotengine.org/en/3.3/tutorials/math/matrices_and_transforms.html</link>
  13. <link title="Using 3D transforms">https://docs.godotengine.org/en/3.3/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. <methods>
  19. <method name="Transform">
  20. <return type="Transform">
  21. </return>
  22. <argument index="0" name="x_axis" type="Vector3">
  23. </argument>
  24. <argument index="1" name="y_axis" type="Vector3">
  25. </argument>
  26. <argument index="2" name="z_axis" type="Vector3">
  27. </argument>
  28. <argument index="3" name="origin" type="Vector3">
  29. </argument>
  30. <description>
  31. Constructs a Transform from four [Vector3] values (matrix columns). Each axis corresponds to local basis vectors (some of which may be scaled).
  32. </description>
  33. </method>
  34. <method name="Transform">
  35. <return type="Transform">
  36. </return>
  37. <argument index="0" name="basis" type="Basis">
  38. </argument>
  39. <argument index="1" name="origin" type="Vector3">
  40. </argument>
  41. <description>
  42. Constructs a Transform from a [Basis] and [Vector3].
  43. </description>
  44. </method>
  45. <method name="Transform">
  46. <return type="Transform">
  47. </return>
  48. <argument index="0" name="from" type="Transform2D">
  49. </argument>
  50. <description>
  51. Constructs a Transform from a [Transform2D].
  52. </description>
  53. </method>
  54. <method name="Transform">
  55. <return type="Transform">
  56. </return>
  57. <argument index="0" name="from" type="Quat">
  58. </argument>
  59. <description>
  60. Constructs a Transform from a [Quat]. The origin will be [code]Vector3(0, 0, 0)[/code].
  61. </description>
  62. </method>
  63. <method name="Transform">
  64. <return type="Transform">
  65. </return>
  66. <argument index="0" name="from" type="Basis">
  67. </argument>
  68. <description>
  69. Constructs the Transform from a [Basis]. The origin will be Vector3(0, 0, 0).
  70. </description>
  71. </method>
  72. <method name="affine_inverse">
  73. <return type="Transform">
  74. </return>
  75. <description>
  76. Returns the inverse of the transform, under the assumption that the transformation is composed of rotation, scaling and translation.
  77. </description>
  78. </method>
  79. <method name="interpolate_with">
  80. <return type="Transform">
  81. </return>
  82. <argument index="0" name="transform" type="Transform">
  83. </argument>
  84. <argument index="1" name="weight" type="float">
  85. </argument>
  86. <description>
  87. Interpolates the transform to other Transform by weight amount (on the range of 0.0 to 1.0).
  88. </description>
  89. </method>
  90. <method name="inverse">
  91. <return type="Transform">
  92. </return>
  93. <description>
  94. 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).
  95. </description>
  96. </method>
  97. <method name="is_equal_approx">
  98. <return type="bool">
  99. </return>
  100. <argument index="0" name="transform" type="Transform">
  101. </argument>
  102. <description>
  103. Returns [code]true[/code] if this transform and [code]transform[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component.
  104. </description>
  105. </method>
  106. <method name="looking_at">
  107. <return type="Transform">
  108. </return>
  109. <argument index="0" name="target" type="Vector3">
  110. </argument>
  111. <argument index="1" name="up" type="Vector3">
  112. </argument>
  113. <description>
  114. Returns a copy of the transform rotated such that its -Z axis points towards the [code]target[/code] position.
  115. The transform will first be rotated around the given [code]up[/code] vector, and then fully aligned to the target by a further rotation around an axis perpendicular to both the [code]target[/code] and [code]up[/code] vectors.
  116. Operations take place in global space.
  117. </description>
  118. </method>
  119. <method name="orthonormalized">
  120. <return type="Transform">
  121. </return>
  122. <description>
  123. Returns the transform with the basis orthogonal (90 degrees), and normalized axis vectors.
  124. </description>
  125. </method>
  126. <method name="rotated">
  127. <return type="Transform">
  128. </return>
  129. <argument index="0" name="axis" type="Vector3">
  130. </argument>
  131. <argument index="1" name="phi" type="float">
  132. </argument>
  133. <description>
  134. Rotates the transform around the given axis by the given angle (in radians), using matrix multiplication. The axis must be a normalized vector.
  135. </description>
  136. </method>
  137. <method name="scaled">
  138. <return type="Transform">
  139. </return>
  140. <argument index="0" name="scale" type="Vector3">
  141. </argument>
  142. <description>
  143. Scales basis and origin of the transform by the given scale factor, using matrix multiplication.
  144. </description>
  145. </method>
  146. <method name="translated">
  147. <return type="Transform">
  148. </return>
  149. <argument index="0" name="offset" type="Vector3">
  150. </argument>
  151. <description>
  152. Translates the transform by the given offset, relative to the transform's basis vectors.
  153. Unlike [method rotated] and [method scaled], this does not use matrix multiplication.
  154. </description>
  155. </method>
  156. <method name="xform">
  157. <return type="Variant">
  158. </return>
  159. <argument index="0" name="v" type="Variant">
  160. </argument>
  161. <description>
  162. Transforms the given [Vector3], [Plane], [AABB], or [PoolVector3Array] by this transform.
  163. </description>
  164. </method>
  165. <method name="xform_inv">
  166. <return type="Variant">
  167. </return>
  168. <argument index="0" name="v" type="Variant">
  169. </argument>
  170. <description>
  171. Inverse-transforms the given [Vector3], [Plane], [AABB], or [PoolVector3Array] by this transform.
  172. </description>
  173. </method>
  174. </methods>
  175. <members>
  176. <member name="basis" type="Basis" setter="" getter="" default="Basis( 1, 0, 0, 0, 1, 0, 0, 0, 1 )">
  177. 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.
  178. </member>
  179. <member name="origin" type="Vector3" setter="" getter="" default="Vector3( 0, 0, 0 )">
  180. The translation offset of the transform (column 3, the fourth column). Equivalent to array index [code]3[/code].
  181. </member>
  182. </members>
  183. <constants>
  184. <constant name="IDENTITY" value="Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
  185. [Transform] with no translation, rotation or scaling applied. When applied to other data structures, [constant IDENTITY] performs no transformation.
  186. </constant>
  187. <constant name="FLIP_X" value="Transform( -1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )">
  188. [Transform] with mirroring applied perpendicular to the YZ plane.
  189. </constant>
  190. <constant name="FLIP_Y" value="Transform( 1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0 )">
  191. [Transform] with mirroring applied perpendicular to the XZ plane.
  192. </constant>
  193. <constant name="FLIP_Z" value="Transform( 1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0 )">
  194. [Transform] with mirroring applied perpendicular to the XY plane.
  195. </constant>
  196. </constants>
  197. </class>