# `unreal.Vector2D`?

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

A vector in 2-D space composed of components (X, Y) with floating point precision. The full C++ class is located here: EngineSourceRuntimeCorePublicMathVector2D.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
`ONE` = None?

(Vector2D) – 2D one vector constant (1,1)

`UNIT45_DEG` = None?

**(Vector2D)* – 2D unit vector constant along the 45 degree angle or symmetrical positive axes (sqrt(.5),sqrt(.5)) or (.707,.707). https* – //en.wikipedia.org/wiki/Unit_vector

`ZERO` = None?

(Vector2D) – 2D zero vector constant (0,0)

`__add__`(other)?

• `Vector2D` Returns addition of Vector A and Vector B (A + B)
• `float` Returns Vector A added by B
`__div__`(other)?

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

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

• `Vector2D` Returns addition of Vector A and Vector B (A + B)
• `float` Returns Vector A added by B
`__idiv__`(other)?

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

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

• `Vector2D` Returns subtraction of Vector B from Vector A (A - B)
• `float` Returns Vector A subtracted by B
`__mul__`(other)?

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

• `Vector2D` Returns true if vector2D A is not equal to vector2D B (A != B) within a specified error tolerance
`__neg__`()?

Gets a negated copy of the vector.

`__or__`(other)?

`__sub__`(other)?

• `Vector2D` Returns subtraction of Vector B from Vector A (A - B)
• `float` Returns Vector A subtracted by B
`__xor__`(other)?

`add`(b) → Vector2D?

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

Parameters: b (Vector2D) – Vector2D
`add_float`(b) → Vector2D?

Returns Vector A added by B

Parameters: b (float) – Vector2D
`clamped_axes`(min_axis_val, max_axis_val) → Vector2D?

Creates a copy of this vector with both axes clamped to the given range.

Parameters: min_axis_val (float) – max_axis_val (float) – New vector with clamped axes. Vector2D
`cross`(b) → float?

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

Parameters: b (Vector2D) – float
`distance`(v2) → float?

Distance between two 2D points.

Parameters: v2 (Vector2D) – The second point. The distance between two 2D points. float
`distance_squared`(v2) → float?

Squared distance between two 2D points.

Parameters: v2 (Vector2D) – The second point. The squared distance between two 2D points. float
`divide`(b) → Vector2D?

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

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

Returns Vector A divided by B

Parameters: b (float) – Vector2D
`dot`(b) → float?

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

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

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

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

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

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

Get the maximum absolute value of the vector’s components.

Returns: The maximum absolute value of the vector’s components. float
`get_max`() → float?

Get the maximum value of the vector’s components.

Returns: The maximum value of the vector’s components. float
`get_min`() → float?

Get the minimum value of the vector’s components.

Returns: The minimum value of the vector’s components. float
`get_rotated`(angle_deg) → Vector2D?

Rotates around axis (0,0,1)

Parameters: angle_deg (float) – Angle to rotate (in degrees) Rotated Vector Vector2D
`int_point`() → IntPoint?

Convert a Vector2D to an IntPoint

Returns: IntPoint
`interp_to`(target, delta_time, interp_speed) → Vector2D?

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

Parameters: target (Vector2D) – 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 Vector2D
`interp_to_constant`(target, delta_time, interp_speed) → Vector2D?

Tries to reach Target at a constant rate.

Parameters: target (Vector2D) – Target position delta_time (float) – Time since last tick interp_speed (float) – Interpolation speed New interpolated position Vector2D
`is_near_equal`(b, error_tolerance=0.000100) → bool?

Returns true if vector2D A is equal to vector2D B (A == B) within a specified error tolerance

Parameters: b (Vector2D) – 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_not_near_equal`(b, error_tolerance=0.000100) → bool?

Returns true if vector2D A is not equal to vector2D B (A != B) within a specified error tolerance

Parameters: b (Vector2D) – error_tolerance (float) – 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 a 2D Vector.

Returns: float
`length_squared`() → float?

Returns the squared length of a 2D Vector.

Returns: float
`multiply`(b) → Vector2D?

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

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

Returns Vector A scaled by B

Parameters: b (float) – Vector2D
`negated`() → Vector2D?

Gets a negated copy of the vector.

Returns: Vector2D
`normal`(tolerance=0.000000) → Vector2D?

Gets a normalized copy of the vector, checking 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 length of vector for normalization. A normalized copy of the vector if safe, (0,0) otherwise. Vector2D
`normal_unsafe`() → Vector2D?

Returns a unit normal version of the 2D vector

Returns: Vector2D
`normalize`(tolerance=0.000000) → None?

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

Parameters: tolerance (float) – Minimum squared length of vector for normalization.
`not_equal`(b) → bool?

Returns true if vector2D A is not equal to vector2D B (A != B) within a specified error tolerance

Parameters: b (Vector2D) – bool
`set`(x, y) → None?

Set the values of the vector directly.

Parameters: x (float) – y (float) –
`spherical_to_unit_cartesian`() → Vector?

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

Returns: Vector
`subtract`(b) → Vector2D?

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

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

Returns Vector A subtracted by B

Parameters: b (float) – Vector2D
`to_direction_and_length`() -> (out_dir=Vector2D, out_length=float)?

Util to convert this vector into a unit direction vector and its original length.

Returns: out_dir (Vector2D): Reference passed in to store unit direction vector.out_length (float): Reference passed in to store length of the vector. tuple
`to_rounded`() → Vector2D?

Get this vector as a vector where each component has been rounded to the nearest int.

Returns: New FVector2D from this vector that is rounded. Vector2D
`to_sign`() → Vector2D?

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: A copy of the vector with each component set to +1 or -1 Vector2D
`vector`(z=0.000000) → Vector?

Convert a Vector2D to a Vector

Parameters: z (float) – Vector
`x`?

`y`?