Transform.xml 7.2 KB

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