Quat.xml 6.1 KB

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