unreal.Vector4

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

Bases: unreal.StructBase

A 4-D homogeneous vector. 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 (float): [Read-Write] W
  • x (float): [Read-Write] X
  • y (float): [Read-Write] Y
  • z (float): [Read-Write] Z
ZERO = None

(Vector4) – 4D vector zero constant (0,0,0)

__add__(other)

Overloads:

  • Vector4 Returns addition of Vector A and Vector B (A + B)
__div__(other)

Overloads:

  • Vector4 Element-wise Vector divide (Result = {A.x/B.x, A.y/B.y, A.z/B.z, A.w/B.w})
__eq__(other)

Overloads:

  • Vector4 Returns true if vector A is equal to vector B (A == B)
__iadd__(other)

Overloads:

  • Vector4 Returns addition of Vector A and Vector B (A + B)
__idiv__(other)

Overloads:

  • Vector4 Element-wise Vector divide (Result = {A.x/B.x, A.y/B.y, A.z/B.z, A.w/B.w})
__imul__(other)

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)

Overloads:

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

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)

Overloads:

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

Gets a negated copy of the vector. Equivalent to -Vector for scripts.

__or__(other)

Overloads:

__sub__(other)

Overloads:

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

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

Parameters:b (Vector4) –
Returns:
Return type:Vector4
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

Parameters:b (Vector4) –
Returns:
Return type:Vector4
divide(b) → Vector4

Element-wise Vector divide (Result = {A.x/B.x, A.y/B.y, A.z/B.z, A.w/B.w})

Parameters:b (Vector4) –
Returns:
Return type:Vector4
dot(b) → float

Returns the dot product of two vectors - see http://mathworld.wolfram.com/DotProduct.html

Parameters:b (Vector4) –
Returns:
Return type:float
dot3(b) → float

Returns the dot product of two vectors - see http://mathworld.wolfram.com/DotProduct.html The W element is ignored.

Parameters:b (Vector4) –
Returns:
Return type:float
equals(b) → bool

Returns true if vector A is equal to vector B (A == B)

Parameters:b (Vector4) –
Returns:
Return type:bool
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:bool
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

Parameters:
Returns:

Return type:

bool

is_nearly_zero3(tolerance=0.000100) → bool

Checks whether vector is near to zero within a specified tolerance. The W element is ignored.

Parameters:tolerance (float) – Error tolerance.
Returns:true if vector is in tolerance to zero, otherwise false.
Return type:bool
is_normal3() → bool

Determines if vector is normalized / unit (length 1). The W element is ignored.

Returns:true if normalized, false otherwise.
Return type:bool
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

Parameters:
Returns:

Return type:

bool

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.

Parameters:squared_lenth_tolerance (float) –
Returns:true if unit, false otherwise.
Return type:bool
is_zero() → bool

Checks whether all components of the vector are exactly zero.

Returns:true if vector is exactly zero, otherwise false.
Return type:bool
length() → float

Returns the length of the vector.

Returns:
Return type:float
length3() → float

Returns the length of the vector. The W element is ignored.

Returns:
Return type:float
length_squared() → float

Returns the squared length of the vector.

Returns:
Return type:float
length_squared3() → float

Returns the squared length of the vector. The W element is ignored.

Returns:
Return type:float
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.

Parameters:surface_normal (Vector4) – A normal of the surface the ray should be reflected on.
Returns:Reflected vector.
Return type:Vector4
multiply(b) → Vector4

Element-wise Vector multiplication (Result = {A.x*B.x, A.y*B.y, A.z*B.z, A.w*B.w})

Parameters:b (Vector4) –
Returns:
Return type:Vector4
negated() → Vector4

Gets a negated copy of the vector. Equivalent to -Vector for scripts.

Returns:
Return type:Vector4
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.

Parameters:tolerance (float) – Minimum squared vector length.
Returns:A normalized copy if safe, (0,0,0) otherwise.
Return type:Vector4
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:Vector4
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

Parameters:b (Vector4) –
Returns:
Return type:bool
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. If you don’t care about preserving the up vector and just want the most direct rotation, you can use the faster ‘FQuat::FindBetweenVectors(FVector::ForwardVector, YourVector)’ or ‘FQuat::FindBetweenNormals(…)’ if you know the vector is of unit length.:

Returns:Quaternion from the Vector’s direction, without any roll.
Return type:Quat
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:Rotator
set(x, y, z, w) → None

Set the values of the vector directly.

Parameters:
  • x (float) – New X coordinate.
  • y (float) – New Y coordinate.
  • z (float) – New Z coordinate.
  • w (float) – New W coordinate.
subtract(b) → Vector4

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

Parameters:b (Vector4) –
Returns:
Return type:Vector4
vector() → Vector

Convert a Vector4 to a Vector (dropping the W element)

Returns:
Return type:Vector
w

(float) – [Read-Write] W

x

(float) – [Read-Write] X

y

(float) – [Read-Write] Y

z

(float) – [Read-Write] Z