`unreal.Vector`?

class `unreal.``Vector`(x=0.0, y=0.0, z=0.0)?

A point or direction FVector in 3d space. The full C++ class is located here: EngineSourceRuntimeCorePublicMathVector.h:

C++ Source:

• Module: CoreUObject
• File: NoExportTypes.h

Editor Properties: (see get_editor_property/set_editor_property)

• `x` (float): [Read-Write] X
• `y` (float): [Read-Write] Y
• `z` (float): [Read-Write] Z
`BACKWARD` = None?

(Vector) – 3D vector Unreal backward direction constant (-1,0,0)

`DOWN` = None?

(Vector) – 3D vector Unreal down direction constant (0,0,-1)

`FORWARD` = None?

(Vector) – 3D vector Unreal forward direction constant (1,0,0)

`LEFT` = None?

(Vector) – 3D vector Unreal left direction constant (0,-1,0)

`ONE` = None?

(Vector) – 3D vector one constant (1,1,1)

`RIGHT` = None?

(Vector) – 3D vector Unreal right direction constant (0,1,0)

`UP` = None?

(Vector) – 3D vector Unreal up direction constant (0,0,1)

`ZERO` = None?

(Vector) – 3D vector zero constant (0,0,0)

`__add__`(other)?

• `Vector` Vector addition
`__div__`(other)?

• `Vector` Element-wise Vector division (Result = {A.x/B.x, A.y/B.y, A.z/B.z})
• `float` Vector divide by a float
`__eq__`(other)?

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

• `Vector` Vector addition
`__idiv__`(other)?

• `Vector` Element-wise Vector division (Result = {A.x/B.x, A.y/B.y, A.z/B.z})
• `float` Vector divide by a float
`__imul__`(other)?

• `Vector` Element-wise Vector multiplication (Result = {A.x*B.x, A.y*B.y, A.z*B.z})
• `float` Scales Vector A by B
`__isub__`(other)?

• `Vector` Vector subtraction
`__mul__`(other)?

• `Vector` Element-wise Vector multiplication (Result = {A.x*B.x, A.y*B.y, A.z*B.z})
• `float` Scales Vector A by B
`__ne__`(other)?

• `Vector` Returns true if vector A is not equal to vector B (A != B)
`__neg__`()?

Negate a vector.

`__or__`(other)?

`__sub__`(other)?

• `Vector` Vector subtraction
`__xor__`(other)?

`add`(b) → Vector?

Parameters: b (Vector) – Vector
`add_bounded`(add_vect, radius) → None?

Add a vector to this and clamp the result to an axis aligned cube centered at the origin.

`add_float`(b) → Vector?

Adds a float to each component of a vector

Parameters: b (float) – Vector
`add_int`(b) → Vector?

Adds an integer to each component of a vector

Parameters: b (int32) – Vector
`assign`(vector) → None?

Assign the values of the supplied vector.

Parameters: vector (Vector) – Vector to copy values from.
`bounded_to_box`(box_min, box_max) → Vector?

Get a copy of this vector, clamped inside of the specified axis aligned cube.

Parameters: box_min (Vector) – box_max (Vector) – Vector
`bounded_to_cube`(radius) → Vector?

Get a copy of this vector, clamped inside of an axis aligned cube centered at the origin.

Parameters: radius (float) – Half size of the cube (or radius of sphere circumscribed in the cube). A copy of this vector, bound by cube. Vector
`clamped_size`(min, max) → Vector?

Create a copy of this vector, with its magnitude/size/length clamped between Min and Max.

Parameters: min (float) – max (float) – Vector
`clamped_size2d`(min, max) → Vector?

Create a copy of this vector, with the 2D magnitude/size/length clamped between Min and Max. Z is unchanged.

Parameters: min (float) – max (float) – Vector
`clamped_size_max`(max) → Vector?

Create a copy of this vector, with its maximum magnitude/size/length clamped to MaxSize.

Parameters: max (float) – Vector
`clamped_size_max2d`(max) → Vector?

Create a copy of this vector, with the maximum 2D magnitude/size/length clamped to MaxSize. Z is unchanged.

Parameters: max (float) – Vector
`cosine_angle2d`(b) → float?

Returns the cosine of the angle between this vector and another projected onto the XY plane (no Z).

Parameters: b (Vector) – the other vector to find the 2D cosine of the angle with. The cosine. float
`cross`(b) → Vector?

Returns the cross product of two 3d vectors - see http://mathworld.wolfram.com/CrossProduct.html

Parameters: b (Vector) – Vector
`direction_unit_to`(to) → Vector?

Find the unit direction vector from one position to another or (0,0,0) if positions are the same.

Parameters: to (Vector) – Vector
`distance`(v2) → float?

Distance between two points.

Parameters: v2 (Vector) – The second point. The distance between two points. float
`distance2d`(v2) → float?

Euclidean distance between two points in the XY plane (ignoring Z).

Parameters: v2 (Vector) – The second point. The distance between two points in the XY plane. float
`distance2d_squared`(v2) → float?

Squared euclidean distance between two points in the XY plane (ignoring Z).

Parameters: v2 (Vector) – The second point. The distance between two points in the XY plane. float
`distance_squared`(v2) → float?

Squared distance between two points.

Parameters: v2 (Vector) – The second point. The squared distance between two points. float
`divide`(b=[1.000000, 1.000000, 1.000000]) → Vector?

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

Parameters: b (Vector) – Vector
`divide_float`(b=1.000000) → Vector?

Vector divide by a float

Parameters: b (float) – Vector
`divide_int`(b=1) → Vector?

Vector divide by an integer

Parameters: b (int32) – Vector
`dot`(b) → float?

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

Parameters: b (Vector) – float
`equals`(b) → bool?

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

Parameters: b (Vector) – bool
`get_abs`() → Vector?

Get a copy of this vector with absolute value of each component.

Returns: A copy of this vector with absolute value of each component. Vector
`get_abs_max`() → float?

Find the maximum absolute element (abs(X), abs(Y) or abs(Z)) of a vector

Returns: float
`get_abs_min`() → float?

Find the minimum absolute element (abs(X), abs(Y) or abs(Z)) of a vector

Returns: float
`get_max`(b) → Vector?

Find the maximum elements (X, Y and Z) between the two vector’s components

Parameters: b (Vector) – Vector
`get_max_element`() → float?

Find the maximum element (X, Y or Z) of a vector

Returns: float
`get_min`(b) → Vector?

Find the minimum elements (X, Y and Z) between the two vector’s components

Parameters: b (Vector) – Vector
`get_min_element`() → float?

Find the minimum element (X, Y or Z) of a vector

Returns: float
`get_projection`() → Vector?

Projects 2D components of vector based on Z.

Returns: Projected version of vector based on Z. Vector
`get_sign_vector`() → Vector?

Get a copy of the vector as sign only. Each component is set to +1 or -1, with the sign of zero treated as +1.

Returns: Vector
`heading_angle`() → float?

Convert a direction vector into a ‘heading’ angle.

Returns: ‘Heading’ angle between +/-PI radians. 0 is pointing down +X. float
`interp_spring_to`(target, spring_state, stiffness, critical_damping_factor, delta_time, mass=1.000000) -> (Vector, spring_state=VectorSpringState)?

Uses a simple spring model to interpolate a vector from Current to Target.

Parameters: target (Vector) – Target value spring_state (VectorSpringState) – 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) – mass (float) – Multiplier that acts like mass on a spring spring_state (VectorSpringState): VectorSpringState
`interp_to`(target, delta_time, interp_speed) → Vector?

Tries to reach Target based on distance from Current position, giving a nice smooth feeling when tracking a position.

Parameters: target (Vector) – Target position delta_time (float) – Time since last tick interp_speed (float) – Interpolation speed, if the speed given is 0, then jump to the target. New interpolated position Vector
`interp_to_constant`(target, delta_time, interp_speed) → Vector?

Tries to reach Target at a constant rate.

Parameters: target (Vector) – Target position delta_time (float) – Time since last tick interp_speed (float) – Interpolation speed New interpolated position Vector
`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 (Vector) – error_tolerance (float) – bool
`is_nearly_zero`(tolerance=0.000100) → bool?

Checks whether vector is near to zero within a specified tolerance.

Parameters: tolerance (float) – Error tolerance. true if vector is in tolerance to zero, otherwise false. bool
`is_normal`() → bool?

Determines if vector is normalized / unit (length 1).

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 (Vector) – error_tolerance (float) – bool
`is_uniform`(tolerance=0.000100) → bool?

Checks whether all components of this vector are the same, within a tolerance.

Parameters: tolerance (float) – Error tolerance. true if the vectors are equal within tolerance limits, false otherwise. bool
`is_unit`(squared_lenth_tolerance=0.000100) → bool?

Determines if vector is normalized / unit (length 1) within specified squared tolerance.

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
`length2d`() → float?

Returns the length of the vector’s XY components.

Returns: float
`length2d_squared`() → float?

Returns the squared length of the vector’s XY components.

Returns: float
`length_squared`() → float?

Returns the squared length of the vector

Returns: float
`lerp_to`(b, alpha) → Vector?

Linearly interpolates between A and B based on Alpha (100% of A when Alpha=0 and 100% of B when Alpha=1)

Parameters: b (Vector) – alpha (float) – Vector
`linear_color`() → LinearColor?

Converts a vector to LinearColor

Returns: LinearColor
`mirror_by_plane`(plane) → Vector?

Mirrors a vector about a plane.

Parameters: plane (Plane) – Mirrored vector. Vector
`mirror_by_vector`(surface_normal) → Vector?

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!

Parameters: surface_normal (Vector) – A normal of the surface the ray should be reflected on. Reflected vector. Vector
`multiply`(b) → Vector?

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

Parameters: b (Vector) – Vector
`multiply_float`(b) → Vector?

Scales Vector A by B

Parameters: b (float) – Vector
`multiply_int`(b) → Vector?

Scales Vector A by B

Parameters: b (int32) – Vector
`negated`() → Vector?

Negate a vector.

Returns: Vector
`normal`(tolerance=0.000100) → Vector?

Gets a normalized unit copy of the vector, ensuring it is safe to do so based on the length. 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. Vector
`normal2d`(tolerance=0.000100) → Vector?

Gets a normalized unit copy of the 2D components of the vector, ensuring it is safe to do so. Z is set to zero. Returns zero vector if vector length is too small to normalize.

Parameters: tolerance (float) – Minimum squared vector length. Normalized copy if safe, (0,0,0) otherwise. Vector
`normal_unsafe`() → Vector?

Calculates normalized unit version of vector without checking for zero length.

Returns: Normalized version of vector. Vector
`normalize`(tolerance=0.000000) → None?

Normalize this vector in-place if it is large enough or set it to (0,0,0) otherwise.

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)

Parameters: b (Vector) – bool
`project_on_to`(target) → Vector?

Projects one vector (V) onto another (Target) and returns the projected vector. If Target is nearly zero in length, returns the zero vector.

Parameters: target (Vector) – Vector on which we are projecting. V projected on to Target. Vector
`project_on_to_normal`(normal) → Vector?

Gets a copy of this vector projected onto the input vector, which is assumed to be unit length.

Parameters: normal (Vector) – Vector to project onto (assumed to be unit length). Projected vector. Vector
`project_on_to_plane`(plane_normal) → Vector?

Projects a vector onto a plane defined by a normalized vector (PlaneNormal).

Parameters: plane_normal (Vector) – Normal of the plane. Vector projected onto the plane. Vector
`project_point_on_to_plane`(plane_base, plane_normal) → Vector?

Projects/snaps a point onto a plane defined by a point on the plane and a plane normal.

Parameters: plane_base (Vector) – A point on the plane. plane_normal (Vector) – Normal of the plane. Point projected onto the plane. Vector
`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
`random_point_in_box_extents`(box_extent) → Vector?

Returns a random point within the specified bounding box using the first vector as an origin and the second as the box extents.

Parameters: box_extent (Vector) – Vector
`reciprocal`() → Vector?

Gets the reciprocal of this vector, avoiding division by zero. Zero components are set to BIG_NUMBER.

Returns: Reciprocal of this vector. Vector
`rotate`(b) → Vector?

Returns result of vector A rotated by Rotator B

Parameters: b (Rotator) – Vector
`rotate_angle_axis`(angle_deg, axis) → Vector?

Returns result of vector A rotated by AngleDeg around Axis

Parameters: angle_deg (float) – axis (Vector) – Vector
`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
`rotator_from_axis_and_angle`(angle) → Rotator?

Create a rotation from an this axis and supplied angle (in degrees)

Parameters: angle (float) – Rotator
`set`(x, y, z) → None?

Set the values of the vector directly.

Parameters: x (float) – y (float) – z (float) –
`snapped_to_grid`(grid_size) → Vector?

Gets a copy of this vector snapped to a grid.

Parameters: grid_size (float) – Grid dimension / step. A copy of this vector snapped to a grid. Vector
`subtract`(b) → Vector?

Vector subtraction

Parameters: b (Vector) – Vector
`subtract_float`(b) → Vector?

Subtracts a float from each component of a vector

Parameters: b (float) – Vector
`subtract_int`(b) → Vector?

Subtracts an integer from each component of a vector

Parameters: b (int32) – Vector
`to_degrees`() → Vector?

Converts a vector containing radian values to a vector containing degree values.

Returns: Vector containing degree values Vector
`to_radians`() → Vector?

Converts a vector containing degree values to a vector containing radian values.

Returns: Vector containing radian values Vector
`transform`() → Transform?

Convert a vector to a transform. Uses vector as location

Returns: Transform
`truncated`() → IntVector?

Rounds A to an integer with truncation towards zero for each element in a vector. (e.g. -1.7 truncated to -1, 2.8 truncated to 2)

Returns: IntVector
`unit_cartesian_to_spherical`() → Vector2D?

Converts a Cartesian unit vector into spherical coordinates on the unit sphere.

Returns: Output Theta will be in the range [0, PI], and output Phi will be in the range [-PI, PI]. Vector2D
`unrotate`(b) → Vector?

Returns result of vector A rotated by the inverse of Rotator B

Parameters: b (Rotator) – Vector
`unwind_euler`() → None?

When this vector contains Euler angles (degrees), ensure that angles are between +/-180

`vector2d`() → Vector2D?

Convert a Vector to a Vector2D using the Vector’s (X, Y) coordinates

Returns: Vector2D
`x`?

`y`?
`z`?