# `unreal.Vector4`¶

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

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)

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

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

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

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

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

• `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` Returns subtraction of Vector B from Vector A (A - B)
`__mul__`(other)

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

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

`__sub__`(other)

• `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) – 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) – 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) – Vector4
`dot`(b) → float

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

Parameters: b (Vector4) – 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) – float
`equals`(b) → bool

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

Parameters: b (Vector4) – bool
`is_nan`() → bool

Determines if any component is not a number (NAN)

Returns: true if one or more components is NAN, otherwise false. 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: b (Vector4) – error_tolerance (float) – 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. true if vector is in tolerance to zero, otherwise false. bool
`is_normal3`() → bool

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

Returns: true if normalized, false otherwise. 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: b (Vector4) – error_tolerance (float) – 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) – true if unit, false otherwise. bool
`is_zero`() → bool

Checks whether all components of the vector are exactly zero.

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

Returns the length of the vector.

Returns: float
`length3`() → float

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

Returns: float
`length_squared`() → float

Returns the squared length of the vector.

Returns: float
`length_squared3`() → float

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

Returns: 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. Reflected vector. 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) – Vector4
`negated`() → Vector4

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

Returns: 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. A normalized copy if safe, (0,0,0) otherwise. 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. 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) – 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. 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. 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) – Vector4
`vector`() → Vector

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

Returns: Vector
`w`

`x`
`y`
`z`