unreal.Vector2D
¶
- class unreal.Vector2D(x=0.0, y=0.0)¶
Bases:
unreal.StructBase
A vector in 2-D space composed of components (X, Y) with floating point precision. note: 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
(double): [Read-Write] Xy
(double): [Read-Write] Y
- UNIT45_DEG = None¶
//en.wikipedia.org/wiki/Unit_vector
- Type
(Vector2D)
- Type
2D unit vector constant along the 45 degree angle or symmetrical positive axes (sqrt(.5),sqrt(.5)) or (.707,.707). https
- __add__(other)¶
Overloads:
Vector2D
Returns addition of Vector A and Vector B (A + B)double
Returns Vector A added by B
- __eq__(other)¶
Overloads:
Vector2D
Returns true if vector A is equal to vector B (A == B)
- __iadd__(other)¶
Overloads:
Vector2D
Returns addition of Vector A and Vector B (A + B)double
Returns Vector A added by B
- __imul__(other)¶
Overloads:
Vector2D
Element-wise Vector multiplication (Result = {A.x*B.x, A.y*B.y})double
Returns Vector A scaled by B
- __isub__(other)¶
Overloads:
Vector2D
Returns subtraction of Vector B from Vector A (A - B)double
Returns Vector A subtracted by B
- __mul__(other)¶
Overloads:
Vector2D
Element-wise Vector multiplication (Result = {A.x*B.x, A.y*B.y})double
Returns Vector A scaled by B
- __ne__(other)¶
Overloads:
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)¶
Overloads:
Vector2D
Returns the dot product of two 2d vectors - see http://mathworld.wolfram.com/DotProduct.html
- __sub__(other)¶
Overloads:
Vector2D
Returns subtraction of Vector B from Vector A (A - B)double
Returns Vector A subtracted by B
- __truediv__(other)¶
Overloads:
Vector2D
Element-wise Vector divide (Result = {A.x/B.x, A.y/B.y})double
Returns Vector A divided by B
- __xor__(other)¶
Overloads:
Vector2D
Returns the cross product of two 2d vectors - see http://mathworld.wolfram.com/CrossProduct.html
- 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 (double) –
max_axis_val (double) –
- Returns
New vector with clamped axes.
- Return type
- cross(b) double ¶
Returns the cross product of two 2d vectors - see http://mathworld.wolfram.com/CrossProduct.html
- Parameters
b (Vector2D) –
- Return type
double
- distance(v2) double ¶
Distance between two 2D points.
- Parameters
v2 (Vector2D) – The second point.
- Returns
The distance between two 2D points.
- Return type
double
- distance_squared(v2) double ¶
Squared distance between two 2D points.
- Parameters
v2 (Vector2D) – The second point.
- Returns
The squared distance between two 2D points.
- Return type
double
- divide_float(b=1.000000) Vector2D ¶
Returns Vector A divided by B
- Parameters
b (double) –
- Return type
- dot(b) double ¶
Returns the dot product of two 2d vectors - see http://mathworld.wolfram.com/DotProduct.html
- Parameters
b (Vector2D) –
- Return type
double
- 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.
- Return type
- get_abs_max() double ¶
Get the maximum absolute value of the vector’s components.
- Returns
The maximum absolute value of the vector’s components.
- Return type
double
- get_max() double ¶
Get the maximum value of the vector’s components.
- Returns
The maximum value of the vector’s components.
- Return type
double
- get_min() double ¶
Get the minimum value of the vector’s components.
- Returns
The minimum value of the vector’s components.
- Return type
double
- 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.
- interp_to_constant(target, delta_time, interp_speed) Vector2D ¶
Tries to reach Target at a constant rate.
- 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
- is_nearly_zero(tolerance=0.000100) bool ¶
Checks whether vector is near to zero within a specified tolerance.
- 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
- 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 a 2D Vector.
- Return type
double
- length_squared() double ¶
Returns the squared length of a 2D Vector.
- Return type
double
- 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.
- normalize(tolerance=0.000000) None ¶
Normalize this vector in-place if it is large enough, set it to (0,0) otherwise. see: 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
- spherical_to_unit_cartesian() Vector ¶
Converts spherical coordinates on the unit sphere into a Cartesian unit length vector.
- Return type
- to_direction_and_length() -> (out_dir=Vector2D, out_length=double)¶
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 (double): Reference passed in to store length of the vector.
- Return type
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.
- Return type
- 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
- Return type
- property x¶
[Read-Write] X
- Type
(double)
- property y¶
[Read-Write] Y
- Type
(double)