Quat.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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. </tutorials>
  14. <demos>
  15. </demos>
  16. <methods>
  17. <method name="Quat">
  18. <return type="Quat">
  19. </return>
  20. <argument index="0" name="from" type="Basis">
  21. </argument>
  22. <description>
  23. Returns the rotation matrix corresponding to the given quaternion.
  24. </description>
  25. </method>
  26. <method name="Quat">
  27. <return type="Quat">
  28. </return>
  29. <argument index="0" name="euler" type="Vector3">
  30. </argument>
  31. <description>
  32. 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).
  33. </description>
  34. </method>
  35. <method name="Quat">
  36. <return type="Quat">
  37. </return>
  38. <argument index="0" name="axis" type="Vector3">
  39. </argument>
  40. <argument index="1" name="angle" type="float">
  41. </argument>
  42. <description>
  43. Returns a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector.
  44. </description>
  45. </method>
  46. <method name="Quat">
  47. <return type="Quat">
  48. </return>
  49. <argument index="0" name="x" type="float">
  50. </argument>
  51. <argument index="1" name="y" type="float">
  52. </argument>
  53. <argument index="2" name="z" type="float">
  54. </argument>
  55. <argument index="3" name="w" type="float">
  56. </argument>
  57. <description>
  58. Returns a quaternion defined by these values.
  59. </description>
  60. </method>
  61. <method name="cubic_slerp">
  62. <return type="Quat">
  63. </return>
  64. <argument index="0" name="b" type="Quat">
  65. </argument>
  66. <argument index="1" name="pre_a" type="Quat">
  67. </argument>
  68. <argument index="2" name="post_b" type="Quat">
  69. </argument>
  70. <argument index="3" name="t" type="float">
  71. </argument>
  72. <description>
  73. Performs a cubic spherical-linear interpolation with another quaternion.
  74. </description>
  75. </method>
  76. <method name="dot">
  77. <return type="float">
  78. </return>
  79. <argument index="0" name="b" type="Quat">
  80. </argument>
  81. <description>
  82. Returns the dot product of two quaternions.
  83. </description>
  84. </method>
  85. <method name="get_euler">
  86. <return type="Vector3">
  87. </return>
  88. <description>
  89. 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).
  90. </description>
  91. </method>
  92. <method name="inverse">
  93. <return type="Quat">
  94. </return>
  95. <description>
  96. Returns the inverse of the quaternion.
  97. </description>
  98. </method>
  99. <method name="is_normalized">
  100. <return type="bool">
  101. </return>
  102. <description>
  103. Returns whether the quaternion is normalized or not.
  104. </description>
  105. </method>
  106. <method name="length">
  107. <return type="float">
  108. </return>
  109. <description>
  110. Returns the length of the quaternion.
  111. </description>
  112. </method>
  113. <method name="length_squared">
  114. <return type="float">
  115. </return>
  116. <description>
  117. Returns the length of the quaternion, squared.
  118. </description>
  119. </method>
  120. <method name="normalized">
  121. <return type="Quat">
  122. </return>
  123. <description>
  124. Returns a copy of the quaternion, normalized to unit length.
  125. </description>
  126. </method>
  127. <method name="set_axis_angle">
  128. <argument index="0" name="axis" type="Vector3">
  129. </argument>
  130. <argument index="1" name="angle" type="float">
  131. </argument>
  132. <description>
  133. Set the quaternion to a rotation which rotates around axis by the specified angle, in radians. The axis must be a normalized vector.
  134. </description>
  135. </method>
  136. <method name="set_euler">
  137. <argument index="0" name="euler" type="Vector3">
  138. </argument>
  139. <description>
  140. 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).
  141. </description>
  142. </method>
  143. <method name="slerp">
  144. <return type="Quat">
  145. </return>
  146. <argument index="0" name="b" type="Quat">
  147. </argument>
  148. <argument index="1" name="t" type="float">
  149. </argument>
  150. <description>
  151. Performs a spherical-linear interpolation with another quaternion.
  152. </description>
  153. </method>
  154. <method name="slerpni">
  155. <return type="Quat">
  156. </return>
  157. <argument index="0" name="b" type="Quat">
  158. </argument>
  159. <argument index="1" name="t" type="float">
  160. </argument>
  161. <description>
  162. Performs a spherical-linear interpolation with another quaterion without checking if the rotation path is not bigger than 90°.
  163. </description>
  164. </method>
  165. <method name="xform">
  166. <return type="Vector3">
  167. </return>
  168. <argument index="0" name="v" type="Vector3">
  169. </argument>
  170. <description>
  171. Transforms the vector [code]v[/code] by this quaternion.
  172. </description>
  173. </method>
  174. </methods>
  175. <members>
  176. <member name="w" type="float" setter="" getter="">
  177. W component of the quaternion. Default value: [code]1[/code]
  178. </member>
  179. <member name="x" type="float" setter="" getter="">
  180. X component of the quaternion. Default value: [code]0[/code]
  181. </member>
  182. <member name="y" type="float" setter="" getter="">
  183. Y component of the quaternion. Default value: [code]0[/code]
  184. </member>
  185. <member name="z" type="float" setter="" getter="">
  186. Z component of the quaternion. Default value: [code]0[/code]
  187. </member>
  188. </members>
  189. <constants>
  190. <constant name="IDENTITY" value="Quat( 0, 0, 0, 1 )">
  191. </constant>
  192. </constants>
  193. </class>