`unreal.Quat`¶

class `unreal.``Quat`(x=0.0, y=0.0, z=0.0, w=1.0)

Quaternion. The full C++ class is located here: EngineSourceRuntimeCorePublicMathQuat.h:

C++ Source:

• Module: CoreUObject
• File: NoExportTypes.h

Editor Properties: (see get_editor_property/set_editor_property)

• `w` (float): [Read-Write] W
• `x` (float): [Read-Write] X
• `y` (float): [Read-Write] Y
• `z` (float): [Read-Write] Z
`IDENTITY` = None

(Quat) – Identity quaternion constant

`__add__`(other)

• `Quat` Returns addition of Vector A and Vector B (A + B)
`__eq__`(other)

• `Quat` Returns true if Quaternion A is equal to Quaternion B (A == B) within a specified error tolerance
`__iadd__`(other)

• `Quat` Returns addition of Vector A and Vector B (A + B)
`__imul__`(other)

• `Quat` Gets the result of multiplying two quaternions (A * B).

Order matters when composing quaternions: C = A * B will yield a quaternion C that logically first applies B then A to any subsequent transformation (right first, then left).

@param B The Quaternion to multiply by. @return The result of multiplication (A * B).

`__isub__`(other)

• `Quat` Returns subtraction of Vector B from Vector A (A - B)
`__mul__`(other)

• `Quat` Gets the result of multiplying two quaternions (A * B).

Order matters when composing quaternions: C = A * B will yield a quaternion C that logically first applies B then A to any subsequent transformation (right first, then left).

@param B The Quaternion to multiply by. @return The result of multiplication (A * B).

`__ne__`(other)

• `Quat` Returns true if Quat A is not equal to Quat B (A != B) within a specified error tolerance
`__sub__`(other)

• `Quat` Returns subtraction of Vector B from Vector A (A - B)
`add`(b) → Quat

Returns addition of Vector A and Vector B (A + B)

Parameters: b (Quat) – Quat
`angular_distance`(b) → float

Find the angular distance/difference between two rotation quaternions.

Parameters: b (Quat) – Quaternion to find angle distance to angular distance in radians float
`ensure_shortest_arc_to`(b) → None

Modify the quaternion to ensure that the delta between it and B represents the shortest possible rotation angle.

Parameters: b (Quat) –
`equals`(b, tolerance=0.000100) → bool

Returns true if Quaternion A is equal to Quaternion B (A == B) within a specified error tolerance

Parameters: b (Quat) – tolerance (float) – bool
`euler`() → Vector

Convert a Quaternion into floating-point Euler angles (in degrees).

Returns: Vector
`exp`() → Quat

Used in combination with Log(). Assumes a quaternion with W=0 and V=theta*v (where |v| = 1). Exp(q) = (sin(theta)*v, cos(theta))

Returns: Quat
`get_angle`() → float

Get the angle of this quaternion

Returns: float
`get_axis_x`() → Vector

Get the forward direction (X axis) after it has been rotated by this Quaternion.

Returns: Vector
`get_axis_y`() → Vector

Get the right direction (Y axis) after it has been rotated by this Quaternion.

Returns: Vector
`get_axis_z`() → Vector

Get the up direction (Z axis) after it has been rotated by this Quaternion.

Returns: Vector
`get_rotation_axis`() → Vector

Get the axis of rotation of the Quaternion. This is the axis around which rotation occurs to transform the canonical coordinate system to the target orientation. For the identity Quaternion which has no such rotation, FVector(1,0,0) is returned.

Returns: Vector
`inversed`() → Quat

Return an inversed copy of this quaternion.

Returns: Quat
`is_finite`() → bool

Determine if all the values are finite (not NaN nor Inf) in this Quat.

Returns: bool
`is_identity`(tolerance=0.000100) → bool

Checks whether this Quaternion is an Identity Quaternion. Assumes Quaternion tested is normalized.

Parameters: tolerance (float) – Error tolerance for comparison with Identity Quaternion. true if Quaternion is a normalized Identity Quaternion. bool
`is_non_finite`() → bool

Determine if there are any non-finite values (NaN or Inf) in this Quat.

Returns: bool
`is_normalized`() → bool

Return true if this quaternion is normalized

Returns: bool
`log`() → Quat

Quaternion with W=0 and V=theta*v. Used in combination with Exp().

Returns: Quat
`multiply`(b) → Quat

Gets the result of multiplying two quaternions (A * B).

Order matters when composing quaternions: C = A * B will yield a quaternion C that logically first applies B then A to any subsequent transformation (right first, then left).

Parameters: b (Quat) – The Quaternion to multiply by. The result of multiplication (A * B). Quat
`normalize`(tolerance=0.000100) → None

Normalize this quaternion if it is large enough as compared to the supplied tolerance. If it is too small then set it to the identity quaternion.

Parameters: tolerance (float) – Minimum squared length of quaternion for normalization.
`normalized`(tolerance=0.000100) → Quat

Get a normalized copy of this quaternion. If it is too small, returns an identity quaternion.

Parameters: tolerance (float) – Minimum squared length of quaternion for normalization. Quat
`not_equal`(b, error_tolerance=0.000100) → bool

Returns true if Quat A is not equal to Quat B (A != B) within a specified error tolerance

Parameters: b (Quat) – error_tolerance (float) – bool
`rotate_vector`(v) → Vector

Rotate a vector by this quaternion.

Parameters: v (Vector) – the vector to be rotated vector after rotation Vector
`rotator`() → Rotator

Convert to Rotator representation of this Quaternion.

Returns: Rotator
`set_components`(x, y, z, w) → None

Set X, Y, Z, W components of Quaternion.

Parameters: x (float) – y (float) – z (float) – w (float) –
`set_from_euler`(euler) → None

Convert a vector of floating-point Euler angles (in degrees) into a Quaternion.

Parameters: euler (Vector) – the Euler angles constructed Quat
`size`() → float

Get the length of the quaternion.

Returns: The length of the quaternion. float
`size_squared`() → float

Get the squared length of the quaternion.

Returns: The squared length of the quaternion. float
`subtract`(b) → Quat

Returns subtraction of Vector B from Vector A (A - B)

Parameters: b (Quat) – Quat
`unrotate_vector`(v) → Vector

Rotate a vector by the inverse of this quaternion.

Parameters: v (Vector) – the vector to be rotated vector after rotation by the inverse of this quaternion. Vector
`vector_forward`() → Vector

Get the forward direction (X axis) after it has been rotated by this Quaternion.

Returns: Vector
`vector_right`() → Vector

Get the right direction (Y axis) after it has been rotated by this Quaternion.

Returns: Vector
`vector_up`() → Vector

Get the up direction (Z axis) after it has been rotated by this Quaternion.

Returns: Vector
`w`

`x`
`y`
`z`