Transform.xml 7.0 KB

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