unreal.Quat

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

Bases: unreal.StructBase

Quaternion. note: 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

Identity quaternion constant

Type

(Quat)

__add__(other)

Overloads:

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

__eq__(other)

Overloads:

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

__iadd__(other)

Overloads:

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

__imul__(other)

Overloads:

  • 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)

Overloads:

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

__mul__(other)

Overloads:

  • 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)

Overloads:

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

__sub__(other)

Overloads:

  • 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) –

Returns

Return type

Quat

angular_distance(b)float

Find the angular distance/difference between two rotation quaternions.

Parameters

b (Quat) – Quaternion to find angle distance to

Returns

angular distance in radians

Return type

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.0001)bool

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

Parameters
Returns

Return type

bool

euler()Vector

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

Returns

Return type

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

Return type

Quat

get_angle()float

Get the angle of this quaternion

Returns

Return type

float

get_axis_x()Vector

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

Returns

Return type

Vector

get_axis_y()Vector

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

Returns

Return type

Vector

get_axis_z()Vector

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

Returns

Return type

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

Return type

Vector

inversed()Quat

Return an inversed copy of this quaternion.

Returns

Return type

Quat

is_finite()bool

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

Returns

Return type

bool

is_identity(tolerance=0.0001)bool

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

Parameters

tolerance (float) – Error tolerance for comparison with Identity Quaternion.

Returns

true if Quaternion is a normalized Identity Quaternion.

Return type

bool

is_non_finite()bool

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

Returns

Return type

bool

is_normalized()bool

Return true if this quaternion is normalized

Returns

Return type

bool

log()Quat

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

Returns

Return type

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.

Returns

The result of multiplication (A * B).

Return type

Quat

normalize(tolerance=0.0001)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.0001)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.

Returns

Return type

Quat

not_equal(b, error_tolerance=0.0001)bool

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

Parameters
Returns

Return type

bool

rotate_vector(v)Vector

Rotate a vector by this quaternion.

Parameters

v (Vector) – the vector to be rotated

Returns

vector after rotation

Return type

Vector

rotator()Rotator

Convert to Rotator representation of this Quaternion.

Returns

Return type

Rotator

set_components(x, y, z, w)None

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

Parameters
set_from_euler(euler)None

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

Parameters

euler (Vector) – the Euler angles

size()float

Get the length of the quaternion.

Returns

The length of the quaternion.

Return type

float

size_squared()float

Get the squared length of the quaternion.

Returns

The squared length of the quaternion.

Return type

float

subtract(b)Quat

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

Parameters

b (Quat) –

Returns

Return type

Quat

unrotate_vector(v)Vector

Rotate a vector by the inverse of this quaternion.

Parameters

v (Vector) – the vector to be rotated

Returns

vector after rotation by the inverse of this quaternion.

Return type

Vector

vector_forward()Vector

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

Returns

Return type

Vector

vector_right()Vector

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

Returns

Return type

Vector

vector_up()Vector

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

Returns

Return type

Vector

property w

[Read-Write] W

Type

(float)

property x

[Read-Write] X

Type

(float)

property y

[Read-Write] Y

Type

(float)

property z

[Read-Write] Z

Type

(float)