unreal.Quat
¶
- class unreal.Quat(x: float = 0.0, y: float = 0.0, z: float = 0.0, w: float = 0.0)¶
Bases:
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
(double): [Read-Write]x
(double): [Read-Write]y
(double): [Read-Write] Alias for float/double depending on LWC status. Note: Will be refactored to double before UE5 ships.z
(double): [Read-Write]
- __eq__(other: object) bool ¶
Overloads:
Quat
Returns true if Quaternion A is equal to Quaternion B (A == B) within a specified error tolerance
- __imul__(other: Quat) None ¶
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).
- __mul__(other: Quat) None ¶
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: object) bool ¶
Overloads:
Quat
Returns true if Quat A is not equal to Quat B (A != B) within a specified error tolerance
- 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
- 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))
- Return type:
- get_axis_x() Vector ¶
Get the forward direction (X axis) after it has been rotated by this Quaternion.
- Return type:
- get_axis_y() Vector ¶
Get the right direction (Y axis) after it has been rotated by this Quaternion.
- Return type:
- get_axis_z() Vector ¶
Get the up direction (Z axis) after it has been rotated by this Quaternion.
- Return type:
- 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.
- Return type:
- interp_spring_to(target, spring_state, stiffness, critical_damping_factor, delta_time, mass=1.000000, target_velocity_amount=1.000000, initialize_from_target=False) -> (Quat, spring_state=QuaternionSpringState)¶
Uses a simple spring model to interpolate a quaternion from Current to Target.
- Parameters:
target (Quat) – Target value
spring_state (QuaternionSpringState) – Data related to spring model (velocity, error, etc..) - Create a unique variable per spring
stiffness (float) – How stiff the spring model is (more stiffness means more oscillation around the target value)
critical_damping_factor (float) – How much damping to apply to the spring (0 means no damping, 1 means critically damped which means no oscillation)
delta_time (float) – Time difference since the last update
mass (float) – Multiplier that acts like mass on a spring
target_velocity_amount (float) – If 1 then the target velocity will be calculated and used, which results following the target more closely/without lag. Values down to zero (recommended when using this to smooth data) will progressively disable this effect.
initialize_from_target (bool) – If set then the current value will be set from the target on the first update
- Returns:
spring_state (QuaternionSpringState): Data related to spring model (velocity, error, etc..) - Create a unique variable per spring
- Return type:
- is_finite() bool ¶
Determine if all the values are finite (not NaN nor Inf) in this Quat.
- Return type:
- is_identity(tolerance=0.000100) bool ¶
Checks whether this Quaternion is an Identity Quaternion. Assumes Quaternion tested is normalized.
- is_non_finite() bool ¶
Determine if there are any non-finite values (NaN or Inf) in this Quat.
- Return type:
- 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).
- 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.
- 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
- 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:
- size_squared() float ¶
Get the squared length of the quaternion.
- Returns:
The squared length of the quaternion.
- Return type:
- vector_forward() Vector ¶
Get the forward direction (X axis) after it has been rotated by this Quaternion.
- Return type:
- vector_right() Vector ¶
Get the right direction (Y axis) after it has been rotated by this Quaternion.
- Return type:
- vector_up() Vector ¶
Get the up direction (Z axis) after it has been rotated by this Quaternion.
- Return type: