2017-09-13 04:42:36 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2020-02-01 09:03:48 +08:00
<class name= "Quat" version= "4.0" >
2017-09-13 04:42:36 +08:00
<brief_description >
Quaternion.
</brief_description>
<description >
2018-05-12 08:14:39 +08:00
A unit quaternion used for representing 3D rotations.
2019-06-22 07:04:47 +08:00
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.
2018-05-12 08:14:39 +08:00
Quaternions need to be (re)normalized.
2017-09-13 04:42:36 +08:00
</description>
<tutorials >
2018-11-05 15:46:27 +08:00
<link > https://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html#interpolating-with-quaternions</link>
2017-09-13 04:42:36 +08:00
</tutorials>
<methods >
<method name= "Quat" >
<return type= "Quat" >
</return>
2018-05-28 20:53:15 +08:00
<argument index= "0" name= "from" type= "Basis" >
2017-09-13 04:42:36 +08:00
</argument>
<description >
2018-05-28 20:53:15 +08:00
Returns the rotation matrix corresponding to the given quaternion.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "Quat" >
<return type= "Quat" >
</return>
2018-05-28 20:53:15 +08:00
<argument index= "0" name= "euler" type= "Vector3" >
2017-09-13 04:42:36 +08:00
</argument>
<description >
2019-06-22 07:04:47 +08:00
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).
2017-09-13 04:42:36 +08:00
</description>
</method>
2018-05-12 08:14:39 +08:00
<method name= "Quat" >
<return type= "Quat" >
</return>
2018-05-28 20:53:15 +08:00
<argument index= "0" name= "axis" type= "Vector3" >
</argument>
<argument index= "1" name= "angle" type= "float" >
2018-05-12 08:14:39 +08:00
</argument>
<description >
2018-05-28 20:53:15 +08:00
Returns a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector.
2018-05-12 08:14:39 +08:00
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "Quat" >
<return type= "Quat" >
</return>
2018-05-28 20:53:15 +08:00
<argument index= "0" name= "x" type= "float" >
</argument>
<argument index= "1" name= "y" type= "float" >
</argument>
<argument index= "2" name= "z" type= "float" >
</argument>
<argument index= "3" name= "w" type= "float" >
2017-09-13 04:42:36 +08:00
</argument>
<description >
2018-05-28 20:53:15 +08:00
Returns a quaternion defined by these values.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "cubic_slerp" >
<return type= "Quat" >
</return>
<argument index= "0" name= "b" type= "Quat" >
</argument>
<argument index= "1" name= "pre_a" type= "Quat" >
</argument>
<argument index= "2" name= "post_b" type= "Quat" >
</argument>
<argument index= "3" name= "t" type= "float" >
</argument>
<description >
2017-10-23 04:43:35 +08:00
Performs a cubic spherical-linear interpolation with another quaternion.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "dot" >
<return type= "float" >
</return>
<argument index= "0" name= "b" type= "Quat" >
</argument>
<description >
Returns the dot product of two quaternions.
</description>
</method>
2018-05-12 08:14:39 +08:00
<method name= "get_euler" >
<return type= "Vector3" >
</return>
<description >
2019-06-22 07:04:47 +08:00
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).
2018-05-12 08:14:39 +08:00
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "inverse" >
<return type= "Quat" >
</return>
<description >
Returns the inverse of the quaternion.
</description>
</method>
2019-11-08 15:33:48 +08:00
<method name= "is_equal_approx" >
<return type= "bool" >
</return>
<argument index= "0" name= "quat" type= "Quat" >
</argument>
<description >
2019-12-01 04:08:50 +08:00
Returns [code]true[/code] if this quaterion and [code]quat[/code] are approximately equal, by running [method @GDScript.is_equal_approx] on each component.
2019-11-08 15:33:48 +08:00
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "is_normalized" >
<return type= "bool" >
</return>
<description >
Returns whether the quaternion is normalized or not.
</description>
</method>
<method name= "length" >
<return type= "float" >
</return>
<description >
Returns the length of the quaternion.
</description>
</method>
<method name= "length_squared" >
<return type= "float" >
</return>
<description >
Returns the length of the quaternion, squared.
</description>
</method>
<method name= "normalized" >
<return type= "Quat" >
</return>
<description >
Returns a copy of the quaternion, normalized to unit length.
</description>
</method>
2018-05-12 08:14:39 +08:00
<method name= "set_axis_angle" >
<argument index= "0" name= "axis" type= "Vector3" >
</argument>
2018-05-28 20:53:15 +08:00
<argument index= "1" name= "angle" type= "float" >
2018-05-12 08:14:39 +08:00
</argument>
<description >
2019-06-22 07:04:47 +08:00
Sets the quaternion to a rotation which rotates around axis by the specified angle, in radians. The axis must be a normalized vector.
2018-05-12 08:14:39 +08:00
</description>
</method>
<method name= "set_euler" >
<argument index= "0" name= "euler" type= "Vector3" >
</argument>
<description >
2019-06-22 07:04:47 +08:00
Sets 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).
2018-05-12 08:14:39 +08:00
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "slerp" >
<return type= "Quat" >
</return>
<argument index= "0" name= "b" type= "Quat" >
</argument>
<argument index= "1" name= "t" type= "float" >
</argument>
<description >
2017-10-23 04:43:35 +08:00
Performs a spherical-linear interpolation with another quaternion.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "slerpni" >
<return type= "Quat" >
</return>
<argument index= "0" name= "b" type= "Quat" >
</argument>
<argument index= "1" name= "t" type= "float" >
</argument>
<description >
2017-10-25 01:22:37 +08:00
Performs a spherical-linear interpolation with another quaterion without checking if the rotation path is not bigger than 90°.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "xform" >
<return type= "Vector3" >
</return>
<argument index= "0" name= "v" type= "Vector3" >
</argument>
<description >
2017-10-23 04:43:35 +08:00
Transforms the vector [code]v[/code] by this quaternion.
2017-09-13 04:42:36 +08:00
</description>
</method>
</methods>
<members >
2019-06-29 18:38:01 +08:00
<member name= "w" type= "float" setter= "" getter= "" default= "1.0" >
2019-06-29 21:24:23 +08:00
W component of the quaternion.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "x" type= "float" setter= "" getter= "" default= "0.0" >
2019-06-29 21:24:23 +08:00
X component of the quaternion.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "y" type= "float" setter= "" getter= "" default= "0.0" >
2019-06-29 21:24:23 +08:00
Y component of the quaternion.
2017-09-13 04:42:36 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "z" type= "float" setter= "" getter= "" default= "0.0" >
2019-06-29 21:24:23 +08:00
Z component of the quaternion.
2017-09-13 04:42:36 +08:00
</member>
</members>
<constants >
2018-08-21 06:35:30 +08:00
<constant name= "IDENTITY" value= "Quat( 0, 0, 0, 1 )" >
2020-01-26 13:59:51 +08:00
The identity rotation. Equivalent to an identity matrix. If a vector is transformed by an identity quaternion, it will not change.
2018-08-21 06:35:30 +08:00
</constant>
2017-09-13 04:42:36 +08:00
</constants>
</class>