Quat.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Quat" category="Built-In Types" version="3.1">
  3. <brief_description>
  4. Quaternion.
  5. </brief_description>
  6. <description>
  7. A unit quaternion used for representing 3D rotations.
  8. It is similar to [Basis], which implements matrix representation of rotations, and can be parametrized using both an axis-angle pair or Euler angles. But due to its compactness and the way it is stored in memory, certain operations (obtaining axis-angle and performing SLERP, in particular) are more efficient and robust against floating point errors.
  9. Quaternions need to be (re)normalized.
  10. </description>
  11. <tutorials>
  12. <link>https://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html#interpolating-with-quaternions</link>
  13. <link>https://docs.godotengine.org/en/latest/tutorials/math/rotations.html</link>
  14. </tutorials>
  15. <demos>
  16. </demos>
  17. <methods>
  18. <method name="Quat">
  19. <return type="Quat">
  20. </return>
  21. <argument index="0" name="from" type="Basis">
  22. </argument>
  23. <description>
  24. Returns the rotation matrix corresponding to the given quaternion.
  25. </description>
  26. </method>
  27. <method name="Quat">
  28. <return type="Quat">
  29. </return>
  30. <argument index="0" name="euler" type="Vector3">
  31. </argument>
  32. <description>
  33. Returns a quaternion that will perform a rotation specified by Euler angles (in the YXZ convention: first Z, then X, and Y last), given in the vector format as (X-angle, Y-angle, Z-angle).
  34. </description>
  35. </method>
  36. <method name="Quat">
  37. <return type="Quat">
  38. </return>
  39. <argument index="0" name="axis" type="Vector3">
  40. </argument>
  41. <argument index="1" name="angle" type="float">
  42. </argument>
  43. <description>
  44. Returns a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector.
  45. </description>
  46. </method>
  47. <method name="Quat">
  48. <return type="Quat">
  49. </return>
  50. <argument index="0" name="x" type="float">
  51. </argument>
  52. <argument index="1" name="y" type="float">
  53. </argument>
  54. <argument index="2" name="z" type="float">
  55. </argument>
  56. <argument index="3" name="w" type="float">
  57. </argument>
  58. <description>
  59. Returns a quaternion defined by these values.
  60. </description>
  61. </method>
  62. <method name="cubic_slerp">
  63. <return type="Quat">
  64. </return>
  65. <argument index="0" name="b" type="Quat">
  66. </argument>
  67. <argument index="1" name="pre_a" type="Quat">
  68. </argument>
  69. <argument index="2" name="post_b" type="Quat">
  70. </argument>
  71. <argument index="3" name="t" type="float">
  72. </argument>
  73. <description>
  74. Performs a cubic spherical-linear interpolation with another quaternion.
  75. </description>
  76. </method>
  77. <method name="dot">
  78. <return type="float">
  79. </return>
  80. <argument index="0" name="b" type="Quat">
  81. </argument>
  82. <description>
  83. Returns the dot product of two quaternions.
  84. </description>
  85. </method>
  86. <method name="get_euler">
  87. <return type="Vector3">
  88. </return>
  89. <description>
  90. Return Euler angles (in the YXZ convention: first Z, then X, and Y last) corresponding to the rotation represented by the unit quaternion. Returned vector contains the rotation angles in the format (X-angle, Y-angle, Z-angle).
  91. </description>
  92. </method>
  93. <method name="inverse">
  94. <return type="Quat">
  95. </return>
  96. <description>
  97. Returns the inverse of the quaternion.
  98. </description>
  99. </method>
  100. <method name="is_normalized">
  101. <return type="bool">
  102. </return>
  103. <description>
  104. Returns whether the quaternion is normalized or not.
  105. </description>
  106. </method>
  107. <method name="length">
  108. <return type="float">
  109. </return>
  110. <description>
  111. Returns the length of the quaternion.
  112. </description>
  113. </method>
  114. <method name="length_squared">
  115. <return type="float">
  116. </return>
  117. <description>
  118. Returns the length of the quaternion, squared.
  119. </description>
  120. </method>
  121. <method name="normalized">
  122. <return type="Quat">
  123. </return>
  124. <description>
  125. Returns a copy of the quaternion, normalized to unit length.
  126. </description>
  127. </method>
  128. <method name="set_axis_angle">
  129. <argument index="0" name="axis" type="Vector3">
  130. </argument>
  131. <argument index="1" name="angle" type="float">
  132. </argument>
  133. <description>
  134. Set the quaternion to a rotation which rotates around axis by the specified angle, in radians. The axis must be a normalized vector.
  135. </description>
  136. </method>
  137. <method name="set_euler">
  138. <argument index="0" name="euler" type="Vector3">
  139. </argument>
  140. <description>
  141. Set the quaternion to a rotation specified by Euler angles (in the YXZ convention: first Z, then X, and Y last), given in the vector format as (X-angle, Y-angle, Z-angle).
  142. </description>
  143. </method>
  144. <method name="slerp">
  145. <return type="Quat">
  146. </return>
  147. <argument index="0" name="b" type="Quat">
  148. </argument>
  149. <argument index="1" name="t" type="float">
  150. </argument>
  151. <description>
  152. Performs a spherical-linear interpolation with another quaternion.
  153. </description>
  154. </method>
  155. <method name="slerpni">
  156. <return type="Quat">
  157. </return>
  158. <argument index="0" name="b" type="Quat">
  159. </argument>
  160. <argument index="1" name="t" type="float">
  161. </argument>
  162. <description>
  163. Performs a spherical-linear interpolation with another quaterion without checking if the rotation path is not bigger than 90°.
  164. </description>
  165. </method>
  166. <method name="xform">
  167. <return type="Vector3">
  168. </return>
  169. <argument index="0" name="v" type="Vector3">
  170. </argument>
  171. <description>
  172. Transforms the vector [code]v[/code] by this quaternion.
  173. </description>
  174. </method>
  175. </methods>
  176. <members>
  177. <member name="w" type="float" setter="" getter="">
  178. W component of the quaternion. Default value: [code]1[/code]
  179. </member>
  180. <member name="x" type="float" setter="" getter="">
  181. X component of the quaternion. Default value: [code]0[/code]
  182. </member>
  183. <member name="y" type="float" setter="" getter="">
  184. Y component of the quaternion. Default value: [code]0[/code]
  185. </member>
  186. <member name="z" type="float" setter="" getter="">
  187. Z component of the quaternion. Default value: [code]0[/code]
  188. </member>
  189. </members>
  190. <constants>
  191. <constant name="IDENTITY" value="Quat( 0, 0, 0, 1 )">
  192. </constant>
  193. </constants>
  194. </class>