unreal.Vector4
¶
- class unreal.Vector4(x: float = 0.0, y: float = 0.0, z: float = 0.0, w: float = 0.0)¶
Bases:
StructBase
A 4-D homogeneous vector. note: The full C++ class is located here: EngineSourceRuntimeCorePublicMathVector4.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:
Vector4
Returns true if vector A is equal to vector B (A == B)
- __iadd__(other: Vector4) None ¶
Overloads:
Vector4
Returns addition of Vector A and Vector B (A + B)
- __imul__(other: Vector4) None ¶
Overloads:
Vector4
Element-wise Vector multiplication (Result = {A.x*B.x, A.y*B.y, A.z*B.z, A.w*B.w})
- __isub__(other: Vector4) None ¶
Overloads:
Vector4
Returns subtraction of Vector B from Vector A (A - B)
- __mul__(other: Vector4) None ¶
Overloads:
Vector4
Element-wise Vector multiplication (Result = {A.x*B.x, A.y*B.y, A.z*B.z, A.w*B.w})
- __ne__(other: object) bool ¶
Overloads:
Vector4
Returns true if vector A is not equal to vector B (A != B) within a specified error tolerance
- __or__(other: Vector4) None ¶
Overloads:
Vector4
Returns the dot product of two vectors - see http://mathworld.wolfram.com/DotProduct.html
- __sub__(other: Vector4) None ¶
Overloads:
Vector4
Returns subtraction of Vector B from Vector A (A - B)
- __truediv__(other: Vector4) None ¶
Overloads:
Vector4
Element-wise Vector divide (Result = {A.x/B.x, A.y/B.y, A.z/B.z, A.w/B.w})
- assign(vector) None ¶
Assign the values of the supplied vector.
- Parameters:
vector (Vector4) – Vector to copy values from.
- cross3(b) Vector4 ¶
Returns the cross product of two vectors - see http://mathworld.wolfram.com/CrossProduct.html
- dot(b) double ¶
Returns the dot product of two vectors - see http://mathworld.wolfram.com/DotProduct.html
- Parameters:
b (Vector4) –
- Return type:
double
- dot3(b) double ¶
Returns the dot product of two vectors - see http://mathworld.wolfram.com/DotProduct.html The W element is ignored.
- Parameters:
b (Vector4) –
- Return type:
double
- is_nan() bool ¶
Determines if any component is not a number (NAN)
- Returns:
true if one or more components is NAN, otherwise false.
- Return type:
- is_near_equal(b, error_tolerance=0.000100) bool ¶
Returns true if vector A is equal to vector B (A == B) within a specified error tolerance
- is_nearly_zero3(tolerance=0.000100) bool ¶
Checks whether vector is near to zero within a specified tolerance. The W element is ignored.
- is_normal3() bool ¶
Determines if vector is normalized / unit (length 1). The W element is ignored.
- Returns:
true if normalized, false otherwise.
- Return type:
- is_not_near_equal(b, error_tolerance=0.000100) bool ¶
Returns true if vector A is not equal to vector B (A != B) within a specified error tolerance
- is_unit3(squared_lenth_tolerance=0.000100) bool ¶
Determines if vector is normalized / unit (length 1) within specified squared tolerance. The W element is ignored.
- is_zero() bool ¶
Checks whether all components of the vector are exactly zero.
- Returns:
true if vector is exactly zero, otherwise false.
- Return type:
- length() double ¶
Returns the length of the vector.
- Return type:
double
- length3() double ¶
Returns the length of the vector. The W element is ignored.
- Return type:
double
- length_squared() double ¶
Returns the squared length of the vector.
- Return type:
double
- length_squared3() double ¶
Returns the squared length of the vector. The W element is ignored.
- Return type:
double
- mirror_by_vector3(surface_normal) Vector4 ¶
Given a direction vector and a surface normal, returns the vector reflected across the surface normal. Produces a result like shining a laser at a mirror! The W element is ignored.
- multiply(b) Vector4 ¶
Element-wise Vector multiplication (Result = {A.x*B.x, A.y*B.y, A.z*B.z, A.w*B.w})
- negated() Vector4 ¶
Gets a negated copy of the vector. Equivalent to -Vector for scripts.
- Return type:
- normal3(tolerance=0.000100) Vector4 ¶
Gets a normalized unit copy of the vector, ensuring it is safe to do so based on the length. The W element is ignored and the returned vector has W=0. Returns zero vector if vector length is too small to safely normalize.
- normal_unsafe3() Vector4 ¶
Calculates normalized unit version of vector without checking for zero length. The W element is ignored and the returned vector has W=0.
- Returns:
Normalized version of vector.
- Return type:
- normalize3(tolerance=0.000000) None ¶
Normalize this vector in-place if it is large enough or set it to (0,0,0,0) otherwise. The W element is ignored and the returned vector has W=0.
- Parameters:
tolerance (float) – Minimum squared length of vector for normalization.
- not_equal(b) bool ¶
Returns true if vector A is not equal to vector B (A != B) within a specified error tolerance
- quaternion() Quat ¶
Return the Quaternion orientation corresponding to the direction in which the vector points. Similar to the FRotator version, returns a result without roll such that it preserves the up vector. note: If you don’t care about preserving the up vector and just want the most direct rotation, you can use the faster ‘FindBetweenVectors(ForwardVector, YourVector)’ or ‘FindBetweenNormals(…)’ if you know the vector is of unit length.
- Returns:
Quaternion from the Vector’s direction, without any roll.
- Return type:
- rotator() Rotator ¶
Return the FRotator orientation corresponding to the direction in which the vector points. Sets Yaw and Pitch to the proper numbers, and sets Roll to zero because the roll can’t be determined from a vector.
- Returns:
FRotator from the Vector’s direction, without any roll.
- Return type:
- set(x, y, z, w) None ¶
Set the values of the vector directly.
- Parameters:
x (double) –
y (double) –
z (double) –
w (double) –