unreal.MathLibrary

class unreal.MathLibrary(outer=None, name='None')

Bases: unreal.BlueprintFunctionLibrary

Kismet Math Library

C++ Source:

  • Module: Engine

  • File: KismetMathLibrary.h

classmethod abs(a)float

Returns the absolute (positive) value of A

Parameters

a (float) –

Returns

Return type

float

classmethod abs_int(a)int32

Returns the absolute (positive) value of A

Parameters

a (int32) –

Returns

Return type

int32

classmethod abs_int64(a)int64

Returns the absolute (positive) value of A

Parameters

a (int64) –

Returns

Return type

int64

classmethod acos(a)float

Returns the inverse cosine (arccos) of A (result is in Radians)

Parameters

a (float) –

Returns

Return type

float

classmethod add_byte_byte(a, b=1)uint8

Addition (A + B)

Parameters
  • a (uint8) –

  • b (uint8) –

Returns

Return type

uint8

classmethod add_date_time_date_time(a, b)DateTime

Addition (A + B)

Parameters
Returns

Return type

DateTime

classmethod add_date_time_timespan(a, b)DateTime

Addition (A + B)

Parameters
Returns

Return type

DateTime

classmethod add_float_float(a, b=1.0)float

Addition (A + B)

Parameters
Returns

Return type

float

classmethod add_int64_int64(a, b=1)int64

Addition (A + B)

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

int64

classmethod add_int_int(a, b=1)int32

Addition (A + B)

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

int32

classmethod add_int_point_int(a, b)IntPoint

Addition (A - B)

Parameters
Returns

Return type

IntPoint

classmethod add_int_point_int_point(a, b)IntPoint

Returns IntPoint A added by B

Parameters
Returns

Return type

IntPoint

classmethod add_linear_color_linear_color(a, b)LinearColor

Element-wise addition of two linear colors (R+R, G+G, B+B, A+A)

Parameters
Returns

Return type

LinearColor

classmethod add_matrix_matrix(a, b)Matrix

Gets the result of adding a matrix to this.

Parameters
Returns

The result of addition.

Return type

Matrix

classmethod add_quat_quat(a, b)Quat

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

Parameters
Returns

Return type

Quat

classmethod add_timespan_timespan(a, b)Timespan

Addition (A + B)

Parameters
Returns

Return type

Timespan

classmethod add_vector2d_float(a, b)Vector2D

Returns Vector A added by B

Parameters
Returns

Return type

Vector2D

classmethod add_vector2d_vector2d(a, b)Vector2D

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

Parameters
Returns

Return type

Vector2D

classmethod add_vector4_vector4(a, b)Vector4

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

Parameters
Returns

Return type

Vector4

classmethod add_vector_float(a, b)Vector

Adds a float to each component of a vector

Parameters
Returns

Return type

Vector

classmethod add_vector_int(a, b)Vector

Adds an integer to each component of a vector

Parameters
  • a (Vector) –

  • b (int32) –

Returns

Return type

Vector

classmethod add_vector_vector(a, b)Vector

Vector addition

Parameters
Returns

Return type

Vector

classmethod and_int64_int64(a, b)int64

Bitwise AND (A & B)

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

int64

classmethod and_int_int(a, b)int32

Bitwise AND (A & B)

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

int32

classmethod asin(a)float

Returns the inverse sine (arcsin) of A (result is in Radians)

Parameters

a (float) –

Returns

Return type

float

classmethod atan(a)float

Returns the inverse tan (atan) (result is in Radians)

Parameters

a (float) –

Returns

Return type

float

classmethod atan2(y, x)float

Returns the inverse tan (atan2) of A/B (result is in Radians)

Parameters
Returns

Return type

float

classmethod b_max(a, b)uint8

Returns the maximum value of A and B

Parameters
  • a (uint8) –

  • b (uint8) –

Returns

Return type

uint8

classmethod b_min(a, b)uint8

Returns the minimum value of A and B

Parameters
  • a (uint8) –

  • b (uint8) –

Returns

Return type

uint8

classmethod boolean_and(a, b)bool

Returns the logical AND of two values (A AND B)

Parameters
Returns

Return type

bool

classmethod boolean_nand(a, b)bool

Returns the logical NAND of two values (A AND B)

Parameters
Returns

Return type

bool

classmethod boolean_nor(a, b)bool

Returns the logical Not OR of two values (A NOR B)

Parameters
Returns

Return type

bool

classmethod boolean_or(a, b)bool

Returns the logical OR of two values (A OR B)

Parameters
Returns

Return type

bool

classmethod boolean_xor(a, b)bool

Returns the logical eXclusive OR of two values (A XOR B)

Parameters
Returns

Return type

bool

classmethod break_color(color) -> (r=float, g=float, b=float, a=float)

Breaks apart a color into individual RGB components (as well as alpha)

Parameters

color (LinearColor) –

Returns

r (float):

g (float):

b (float):

a (float):

Return type

tuple

classmethod break_rot_into_axes(rot) -> (x=Vector, y=Vector, z=Vector)

Breaks apart a rotator into its component axes

Parameters

rot (Rotator) –

Returns

x (Vector):

y (Vector):

z (Vector):

Return type

tuple

classmethod c_interp_to(current, target, delta_time, interp_speed)LinearColor

Interpolate Linear Color from Current to Target. Scaled by distance to Target, so it has a strong start speed and ease out.

Parameters
  • current (LinearColor) – Current Color

  • target (LinearColor) – Target Color

  • delta_time (float) – Time since last tick

  • interp_speed (float) – Interpolation speed, if the speed given is 0, then jump to the target.

Returns

New interpolated Color

Return type

LinearColor

classmethod clamp(value, min, max)int32

Returns Value clamped to be between A and B (inclusive)

Parameters
  • value (int32) –

  • min (int32) –

  • max (int32) –

Returns

Return type

int32

classmethod clamp_angle(angle_degrees, min_angle_degrees, max_angle_degrees)float

Clamps an arbitrary angle to be between the given angles. Will clamp to nearest boundary.

Parameters
  • angle_degrees (float) –

  • min_angle_degrees (float) – “from” angle that defines the beginning of the range of valid angles (sweeping clockwise)

  • max_angle_degrees (float) – “to” angle that defines the end of the range of valid angles

Returns

Returns clamped angle in the range -180..180.

Return type

float

classmethod clamp_axes2d(a, min_axis_val, max_axis_val)Vector2D

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

Parameters
Returns

New vector with clamped axes.

Return type

Vector2D

classmethod clamp_axis(angle)float

Clamps an angle to the range of [0, 360].

Parameters

angle (float) – The angle to clamp.

Returns

The clamped angle.

Return type

float

classmethod clamp_int64(value, min, max)int64

Returns Value clamped to be between A and B (inclusive)

Parameters
  • value (int64) –

  • min (int64) –

  • max (int64) –

Returns

Return type

int64

classmethod clamp_vector_size(a, min, max)Vector

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

Parameters
Returns

Return type

Vector

classmethod class_is_child_of(test_class, parent_class)bool

Determine if a class is a child of another class.

Parameters
Returns

true if TestClass == ParentClass, or if TestClass is a child of ParentClass; false otherwise, or if either the value for either parameter is ‘None’.

Return type

bool

classmethod compose_rotators(a, b)Rotator

Combine 2 rotations to give you the resulting rotation of first applying A, then B.

Parameters
Returns

Return type

Rotator

classmethod compose_transforms(a, b)Transform

Compose two transforms in order: A * B.

Order matters when composing transforms: A * B will yield a transform that logically first applies A then B to any subsequent transformation.

Example: LocalToWorld = ComposeTransforms(DeltaRotation, LocalToWorld) will change rotation in local space by DeltaRotation. Example: LocalToWorld = ComposeTransforms(LocalToWorld, DeltaRotation) will change rotation in world space by DeltaRotation.

Parameters
Returns

New transform: A * B

Return type

Transform

classmethod conv_bool_to_byte(bool)uint8

Converts a bool to a byte

Parameters

bool (bool) –

Returns

Return type

uint8

classmethod conv_bool_to_float(bool)float

Converts a bool to a float (0.0f or 1.0f)

Parameters

bool (bool) –

Returns

Return type

float

classmethod conv_bool_to_int(bool)int32

Converts a bool to an int

Parameters

bool (bool) –

Returns

Return type

int32

classmethod conv_byte_to_float(byte)float

Converts a byte to a float

Parameters

byte (uint8) –

Returns

Return type

float

classmethod conv_byte_to_int(byte)int32

Converts a byte to an integer

Parameters

byte (uint8) –

Returns

Return type

int32

classmethod conv_color_to_linear_color(color)LinearColor

Converts a color to LinearColor

Parameters

color (Color) –

Returns

Return type

LinearColor

classmethod conv_float_to_linear_color(float)LinearColor

Convert a float into a LinearColor, where each element is that float

Parameters

float (float) –

Returns

Return type

LinearColor

classmethod conv_float_to_vector(float)Vector

Convert a float into a vector, where each element is that float

Parameters

float (float) –

Returns

Return type

Vector

classmethod conv_int64_to_byte(int)uint8

Converts a 64 bit integer to a byte (if the integer is too large, returns the low 8 bits)

Parameters

int (int64) –

Returns

Return type

uint8

classmethod conv_int64_to_int(int)int32

Converts a 64 bit integer to a 32 bit integer (if the integer is too large, returns the low 32 bits)

Parameters

int (int64) –

Returns

Return type

int32

classmethod conv_int_point_to_vector2d(int_point)Vector2D

Convert an IntPoint to a Vector2D

Parameters

int_point (IntPoint) –

Returns

Return type

Vector2D

classmethod conv_int_to_bool(int)bool

Converts a int to a bool

Parameters

int (int32) –

Returns

Return type

bool

classmethod conv_int_to_byte(int)uint8

Converts an integer to a byte (if the integer is too large, returns the low 8 bits)

Parameters

int (int32) –

Returns

Return type

uint8

classmethod conv_int_to_float(int)float

Converts an integer to a float

Parameters

int (int32) –

Returns

Return type

float

classmethod conv_int_to_int64(int)int64

Converts an integer to a 64 bit integer

Parameters

int (int32) –

Returns

Return type

int64

classmethod conv_int_to_int_vector(int)IntVector

Converts an integer to an IntVector

Parameters

int (int32) –

Returns

Return type

IntVector

classmethod conv_int_vector_to_vector(int_vector)Vector

Convert an IntVector to a vector

Parameters

int_vector (IntVector) –

Returns

Return type

Vector

classmethod conv_linear_color_to_color(linear_color, use_srgb=True)Color

Quantizes the linear color and returns the result as a FColor with optional sRGB conversion and quality as goal.

Parameters
Returns

Return type

Color

classmethod conv_linear_color_to_vector(linear_color)Vector

Converts a LinearColor to a vector

Parameters

linear_color (LinearColor) –

Returns

Return type

Vector

classmethod conv_matrix_to_rotator(matrix)Rotator

Convert a Matrix to a Rotator (Assumes Matrix represents a transform)

Parameters

matrix (Matrix) –

Returns

Return type

Rotator

classmethod conv_matrix_to_transform(matrix)Transform

Convert a Matrix to a Transform (Assumes Matrix represents a transform)

Parameters

matrix (Matrix) –

Returns

Return type

Transform

classmethod conv_rotator_to_transform(rotator)Transform

Convert Rotator to Transform

Parameters

rotator (Rotator) –

Returns

Return type

Transform

classmethod conv_rotator_to_vector(rot)Vector

Get the X direction vector after this rotation

Parameters

rot (Rotator) –

Returns

Return type

Vector

classmethod conv_transform_to_matrix(transform)Matrix

Convert a Transform to a Matrix with scale

Parameters

transform (Transform) –

Returns

Return type

Matrix

classmethod conv_vector2d_to_int_point(vector2d)IntPoint

Convert a Vector2D to an IntPoint

Parameters

vector2d (Vector2D) –

Returns

Return type

IntPoint

classmethod conv_vector2d_to_vector(vector2d, z=0.0)Vector

Convert a Vector2D to a Vector

Parameters
Returns

Return type

Vector

classmethod conv_vector4_to_quaterion(vec)

deprecated: ‘conv_vector4_to_quaterion’ was renamed to ‘conv_vector4_to_quaternion’.

classmethod conv_vector4_to_quaternion(vec)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. note: 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.

Parameters

vec (Vector4) –

Returns

Quaternion from the Vector’s direction, without any roll.

Return type

Quat

classmethod conv_vector4_to_rotator(vec)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.

Parameters

vec (Vector4) –

Returns

FRotator from the Vector’s direction, without any roll.

Return type

Rotator

classmethod conv_vector4_to_vector(vector4)Vector

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

Parameters

vector4 (Vector4) –

Returns

Return type

Vector

classmethod conv_vector_to_linear_color(vec)LinearColor

Converts a vector to LinearColor

Parameters

vec (Vector) –

Returns

Return type

LinearColor

classmethod conv_vector_to_quaterion(vec)

deprecated: ‘conv_vector_to_quaterion’ was renamed to ‘conv_vector_to_quaternion’.

classmethod conv_vector_to_quaternion(vec)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. note: 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.

Parameters

vec (Vector) –

Returns

Quaternion from the Vector’s direction, without any roll.

Return type

Quat

classmethod conv_vector_to_rotator(vec)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.

Parameters

vec (Vector) –

Returns

FRotator from the Vector’s direction, without any roll.

Return type

Rotator

classmethod conv_vector_to_transform(location)Transform

Convert a vector to a transform. Uses vector as location

Parameters

location (Vector) –

Returns

Return type

Transform

classmethod conv_vector_to_vector2d(vector)Vector2D

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

Parameters

vector (Vector) –

Returns

Return type

Vector2D

classmethod convert_transform_to_relative(transform, parent_transform)Transform

Convert Transform to Relative

Parameters
Returns

Return type

Transform

classmethod cos(a)float

Returns the cosine of A (expects Radians)

Parameters

a (float) –

Returns

Return type

float

classmethod create_vector_from_yaw_pitch(yaw, pitch, length=1.0)Vector

Creates a directional vector from rotation values {Pitch, Yaw} supplied in degrees with specified Length

Parameters
Returns

Return type

Vector

classmethod cross_product2d(a, b)float

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

Parameters
Returns

Return type

float

classmethod cross_vector_vector(a, b)Vector

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

Parameters
Returns

Return type

Vector

classmethod date_time_from_iso_string(iso_string)DateTime or None

Converts a date string in ISO-8601 format to a DateTime object

Parameters

iso_string (str) –

Returns

result (DateTime):

Return type

DateTime or None

classmethod date_time_from_string(date_time_string)DateTime or None

Converts a date string to a DateTime object

Parameters

date_time_string (str) –

Returns

result (DateTime):

Return type

DateTime or None

classmethod date_time_max_value()DateTime

Returns the maximum date and time value

Returns

Return type

DateTime

classmethod date_time_min_value()DateTime

Returns the minimum date and time value

Returns

Return type

DateTime

classmethod days_in_month(year, month)int32

Returns the number of days in the given year and month

Parameters
  • year (int32) –

  • month (int32) –

Returns

Return type

int32

classmethod days_in_year(year)int32

Returns the number of days in the given year

Parameters

year (int32) –

Returns

Return type

int32

classmethod deg_acos(a)float

Returns the inverse cos (arccos) of A (result is in Degrees)

Parameters

a (float) –

Returns

Return type

float

classmethod deg_asin(a)float

Returns the inverse sin (arcsin) of A (result is in Degrees)

Parameters

a (float) –

Returns

Return type

float

classmethod deg_atan(a)float

Returns the inverse tan (atan) (result is in Degrees)

Parameters

a (float) –

Returns

Return type

float

classmethod deg_atan2(y, x)float

Returns the inverse tan (atan2) of A/B (result is in Degrees)

Parameters
Returns

Return type

float

classmethod deg_cos(a)float

Returns the cos of A (expects Degrees)

Parameters

a (float) –

Returns

Return type

float

classmethod deg_sin(a)float

Returns the sin of A (expects Degrees)

Parameters

a (float) –

Returns

Return type

float

classmethod deg_tan(a)float

Returns the tan of A (expects Degrees)

Parameters

a (float) –

Returns

Return type

float

classmethod degrees_to_radians(a)float

Returns radians value based on the input degrees

Parameters

a (float) –

Returns

Return type

float

classmethod distance2d(v1, v2)float

Distance between two 2D points.

Parameters
Returns

The distance between two 2D points.

Return type

float

classmethod distance_squared2d(v1, v2)float

Squared distance between two 2D points.

Parameters
Returns

The squared distance between two 2D points.

Return type

float

classmethod divide_byte_byte(a, b=1)uint8

Division (A / B)

Parameters
  • a (uint8) –

  • b (uint8) –

Returns

Return type

uint8

classmethod divide_int64_int64(a, b=1)int64

Division (A / B)

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

int64

classmethod divide_int_int(a, b=1)int32

Division (A / B)

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

int32

classmethod divide_int_point_int(a, b)IntPoint

Division (A * B)

Parameters
Returns

Return type

IntPoint

classmethod divide_int_point_int_point(a, b)IntPoint

Returns IntPoint A divided by B

Parameters
Returns

Return type

IntPoint

classmethod divide_linear_color_linear_color(a, b)LinearColor

Element-wise multiplication of two linear colors (R/R, G/G, B/B, A/A)

Parameters
Returns

Return type

LinearColor

classmethod divide_timespan_float(a, scalar)Timespan

Scalar division (A / s)

Parameters
Returns

Return type

Timespan

classmethod divide_vector2d_float(a, b=1.0)Vector2D

Returns Vector A divided by B

Parameters
Returns

Return type

Vector2D

classmethod divide_vector2d_vector2d(a, b)Vector2D

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

Parameters
Returns

Return type

Vector2D

classmethod divide_vector4_vector4(a, b)Vector4

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

Parameters
Returns

Return type

Vector4

classmethod divide_vector_float(a, b=1.0)Vector

Vector divide by a float

Parameters
Returns

Return type

Vector

classmethod divide_vector_int(a, b=1)Vector

Vector divide by an integer

Parameters
  • a (Vector) –

  • b (int32) –

Returns

Return type

Vector

classmethod divide_vector_vector(a, b=[1.0, 1.0, 1.0])Vector

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

Parameters
Returns

Return type

Vector

classmethod dot_product2d(a, b)float

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

Parameters
Returns

Return type

float

classmethod dot_vector_vector(a, b)float

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

Parameters
Returns

Return type

float

classmethod dynamic_weighted_moving_average_f_rotator(current_sample, previous_sample, max_distance, min_weight, max_weight)Rotator

Calculates the new value in a weighted moving average series using the previous value and a weight range. The weight range is used to dynamically adjust based upon distance between the samples This allows you to smooth a value more aggressively for small noise and let large movements be smoothed less (or vice versa)

Parameters
  • current_sample (Rotator) – The value to blend with the previous sample to get a new weighted value

  • previous_sample (Rotator) – The last value from the series

  • max_distance (float) – Distance to use as the blend between min weight or max weight

  • min_weight (float) – The weight use when the distance is small

  • max_weight (float) – The weight use when the distance is large

Returns

the next value in the series

Return type

Rotator

classmethod dynamic_weighted_moving_average_f_vector(current_sample, previous_sample, max_distance, min_weight, max_weight)Vector

Calculates the new value in a weighted moving average series using the previous value and a weight range. The weight range is used to dynamically adjust based upon distance between the samples This allows you to smooth a value more aggressively for small noise and let large movements be smoothed less (or vice versa)

Parameters
  • current_sample (Vector) – The value to blend with the previous sample to get a new weighted value

  • previous_sample (Vector) – The last value from the series

  • max_distance (float) – Distance to use as the blend between min weight or max weight

  • min_weight (float) – The weight use when the distance is small

  • max_weight (float) – The weight use when the distance is large

Returns

the next value in the series

Return type

Vector

classmethod dynamic_weighted_moving_average_float(current_sample, previous_sample, max_distance, min_weight, max_weight)float

Calculates the new value in a weighted moving average series using the previous value and a weight range. The weight range is used to dynamically adjust based upon distance between the samples This allows you to smooth a value more aggressively for small noise and let large movements be smoothed less (or vice versa)

Parameters
  • current_sample (float) – The value to blend with the previous sample to get a new weighted value

  • previous_sample (float) – The last value from the series

  • max_distance (float) – Distance to use as the blend between min weight or max weight

  • min_weight (float) – The weight use when the distance is small

  • max_weight (float) – The weight use when the distance is large

Returns

the next value in the series

Return type

float

classmethod equal_equal_bool_bool(a, b)bool

Returns true if the values are equal (A == B)

Parameters
Returns

Return type

bool

classmethod equal_equal_byte_byte(a, b)bool

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

Parameters
  • a (uint8) –

  • b (uint8) –

Returns

Return type

bool

classmethod equal_equal_class_class(a, b)bool

Returns true if A and B are equal (A == B)

Parameters
Returns

Return type

bool

classmethod equal_equal_date_time_date_time(a, b)bool

Returns true if the values are equal (A == B)

Parameters
Returns

Return type

bool

classmethod equal_equal_float_float(a, b)bool

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

Parameters
Returns

Return type

bool

classmethod equal_equal_int64_int64(a, b)bool

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

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

bool

classmethod equal_equal_int_int(a, b)bool

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

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

bool

classmethod equal_equal_linear_color_linear_color(a, b)bool

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

Parameters
Returns

Return type

bool

classmethod equal_equal_matrix_matrix(a, b, tolerance=0.0001)bool

Checks whether another Matrix is equal to this, within specified tolerance.

Parameters
Returns

true if two Matrix are equal, within specified tolerance, otherwise false.

Return type

bool

classmethod equal_equal_name_name(a, b)bool

Returns true if A and B are equal (A == B)

Parameters
Returns

Return type

bool

classmethod equal_equal_object_object(a, b)bool

Returns true if A and B are equal (A == B)

Parameters
Returns

Return type

bool

classmethod equal_equal_quat_quat(a, b, tolerance=0.0001)bool

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

Parameters
Returns

Return type

bool

classmethod equal_equal_rotator_rotator(a, b, error_tolerance=0.0001)bool

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

Parameters
Returns

Return type

bool

classmethod equal_equal_timespan_timespan(a, b)bool

Returns true if the values are equal (A == B)

Parameters
Returns

Return type

bool

classmethod equal_equal_transform_transform(a, b)bool

Returns true if transform A is equal to transform B

Parameters
Returns

Return type

bool

classmethod equal_equal_vector2d_vector2d(a, b, error_tolerance=0.0001)bool

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

Parameters
Returns

Return type

bool

classmethod equal_equal_vector4_vector4(a, b, error_tolerance=0.0001)bool

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

Parameters
Returns

Return type

bool

classmethod equal_equal_vector_vector(a, b, error_tolerance=0.0001)bool

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

Parameters
Returns

Return type

bool

classmethod equal_exactly_vector2d_vector2d(a, b)bool

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

Parameters
Returns

Return type

bool

classmethod equal_exactly_vector4_vector4(a, b)bool

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

Parameters
Returns

Return type

bool

classmethod equal_exactly_vector_vector(a, b)bool

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

Parameters
Returns

Return type

bool

classmethod equal_int_point_int_point(a, b)bool

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

Parameters
Returns

Return type

bool

classmethod exp(a)float

Returns exponential(e) to the power A (e^A)

Parameters

a (float) –

Returns

Return type

float

classmethod f_ceil(a)int32

Rounds A up towards positive infinity / up to the next integer (e.g., -1.6 becomes -1 and 1.6 becomes 2)

Parameters

a (float) –

Returns

Return type

int32

classmethod f_ceil64(a)int64

Rounds A up towards positive infinity / up to the next integer (e.g., -1.6 becomes -1 and 1.6 becomes 2)

Parameters

a (float) –

Returns

Return type

int64

classmethod f_clamp(value, min, max)float

Returns Value clamped between A and B (inclusive)

Parameters
Returns

Return type

float

classmethod f_floor(a)int32

Rounds A down towards negative infinity / down to the previous integer (e.g., -1.6 becomes -2 and 1.6 becomes 1)

Parameters

a (float) –

Returns

Return type

int32

classmethod f_floor64(a)int64

Rounds A down towards negative infinity / down to the previous integer (e.g., -1.6 becomes -2 and 1.6 becomes 1)

Parameters

a (float) –

Returns

Return type

int64

classmethod f_interp_ease_in_out(a, b, alpha, exponent)float

Interpolate between A and B, applying an ease in/out function. Exp controls the degree of the curve.

Parameters
Returns

Return type

float

classmethod f_interp_to(current, target, delta_time, interp_speed)float

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

Parameters
  • current (float) – Actual position

  • target (float) – 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.

Returns

New interpolated position

Return type

float

classmethod f_interp_to_constant(current, target, delta_time, interp_speed)float

Tries to reach Target at a constant rate.

Parameters
  • current (float) – Actual position

  • target (float) – Target position

  • delta_time (float) – Time since last tick

  • interp_speed (float) – Interpolation speed

Returns

New interpolated position

Return type

float

classmethod f_max(a, b)float

Returns the maximum value of A and B

Parameters
Returns

Return type

float

classmethod f_min(a, b)float

Returns the minimum value of A and B

Parameters
Returns

Return type

float

classmethod f_mod(dividend, divisor) -> (int32, remainder=float)

Returns the number of times Divisor will go into Dividend (i.e., Dividend divided by Divisor), as well as the remainder

Parameters
Returns

remainder (float):

Return type

float

classmethod f_rand()

deprecated: ‘f_rand’ was renamed to ‘random_float’.

classmethod f_rand_from_stream(stream)

deprecated: ‘f_rand_from_stream’ was renamed to ‘random_float_from_stream’.

classmethod f_rand_range(min, max)

deprecated: ‘f_rand_range’ was renamed to ‘random_float_in_range’.

classmethod f_rand_range_from_stream(min, max, stream)

deprecated: ‘f_rand_range_from_stream’ was renamed to ‘random_float_in_range_from_stream’.

classmethod f_trunc(a)int32

Rounds A towards zero, truncating the fractional part (e.g., -1.6 becomes -1 and 1.6 becomes 1)

Parameters

a (float) –

Returns

Return type

int32

classmethod f_trunc64(a)int64

Rounds A towards zero, truncating the fractional part (e.g., -1.6 becomes -1 and 1.6 becomes 1)

Parameters

a (float) –

Returns

Return type

int64

classmethod f_trunc_vector(vector)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)

Parameters

vector (Vector) –

Returns

Return type

IntVector

classmethod f_wrap(value, min, max)float

Returns Value wrapped from A and B (inclusive)

Parameters
Returns

Return type

float

classmethod find_closest_point_on_line(point, line_origin, line_direction)Vector

Find the closest point on an infinite line to a given point.

Parameters
  • point (Vector) – Point for which we find the closest point on the line.

  • line_origin (Vector) – Point of reference on the line.

  • line_direction (Vector) – Direction of the line. Not required to be normalized.

Returns

The closest point on the line to the given point.

Return type

Vector

classmethod find_closest_point_on_segment(point, segment_start, segment_end)Vector

Find the closest point on a segment to a given point.

Parameters
  • point (Vector) – Point for which we find the closest point on the segment.

  • segment_start (Vector) – Start of the segment.

  • segment_end (Vector) – End of the segment.

Returns

The closest point on the segment to the given point.

Return type

Vector

classmethod find_look_at_rotation(start, target)Rotator

Find a rotation for an object at Start location to point at Target location.

Parameters
Returns

Return type

Rotator

classmethod find_nearest_points_on_line_segments(segment1_start, segment1_end, segment2_start, segment2_end) -> (segment1_point=Vector, segment2_point=Vector)

Find closest points between 2 segments.

Parameters
  • segment1_start (Vector) – Start of the 1st segment.

  • segment1_end (Vector) – End of the 1st segment.

  • segment2_start (Vector) – Start of the 2nd segment.

  • segment2_end (Vector) – End of the 2nd segment.

Returns

segment1_point (Vector): Closest point on segment 1 to segment 2.

segment2_point (Vector): Closest point on segment 2 to segment 1.

Return type

tuple

classmethod fixed_turn(current, desired, delta_rate)float

Returns a new rotation component value

Parameters
  • current (float) – is the current rotation value

  • desired (float) – is the desired rotation value

  • delta_rate (float) –

Returns

a new rotation component value clamped in the range (-360,360)

Return type

float

classmethod float_spring_interp(current, target, spring_state, stiffness, critical_damping_factor, delta_time, mass=1.000000) -> (float, spring_state=FloatSpringState)

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

Parameters
  • current (float) – Current value

  • target (float) – Target value

  • spring_state (FloatSpringState) – 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

Returns

spring_state (FloatSpringState): Data related to spring model (velocity, error, etc..) - Create a unique variable per spring

Return type

FloatSpringState

classmethod fraction(a)float

Returns the fractional part of a float.

Parameters

a (float) –

Returns

Return type

float

classmethod from_days(days)Timespan

Returns a time span that represents the specified number of days

Parameters

days (float) –

Returns

Return type

Timespan

classmethod from_hours(hours)Timespan

Returns a time span that represents the specified number of hours

Parameters

hours (float) –

Returns

Return type

Timespan

classmethod from_milliseconds(milliseconds)Timespan

Returns a time span that represents the specified number of milliseconds

Parameters

milliseconds (float) –

Returns

Return type

Timespan

classmethod from_minutes(minutes)Timespan

Returns a time span that represents the specified number of minutes

Parameters

minutes (float) –

Returns

Return type

Timespan

classmethod from_seconds(seconds)Timespan

Returns a time span that represents the specified number of seconds

Parameters

seconds (float) –

Returns

Return type

Timespan

classmethod get_abs2d(a)Vector2D

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

Parameters

a (Vector2D) –

Returns

A copy of this vector with absolute value of each component.

Return type

Vector2D

classmethod get_abs_max2d(a)float

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

Parameters

a (Vector2D) –

Returns

The maximum absolute value of the vector’s components.

Return type

float

classmethod get_axes(a) -> (x=Vector, y=Vector, z=Vector)

Get the reference frame direction vectors (axes) described by this rotation

Parameters

a (Rotator) –

Returns

x (Vector):

y (Vector):

z (Vector):

Return type

tuple

classmethod get_date(a)DateTime

Returns the date component of A

Parameters

a (DateTime) –

Returns

Return type

DateTime

classmethod get_day(a)int32

Returns the day component of A (1 to 31)

Parameters

a (DateTime) –

Returns

Return type

int32

classmethod get_day_of_year(a)int32

Returns the day of year of A

Parameters

a (DateTime) –

Returns

Return type

int32

classmethod get_days(a)int32

Returns the days component of A

Parameters

a (Timespan) –

Returns

Return type

int32

classmethod get_direction_unit_vector(from_, to)Vector

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

Parameters
Returns

Return type

Vector

classmethod get_direction_vector(from_, to)

deprecated: ‘get_direction_vector’ was renamed to ‘get_direction_unit_vector’.

classmethod get_duration(a)Timespan

Returns the absolute value of A

Parameters

a (Timespan) –

Returns

Return type

Timespan

classmethod get_forward_vector(rot)Vector

Rotate the world forward vector by the given rotation

Parameters

rot (Rotator) –

Returns

Return type

Vector

classmethod get_hour(a)int32

Returns the hour component of A (24h format)

Parameters

a (DateTime) –

Returns

Return type

int32

classmethod get_hour12(a)int32

Returns the hour component of A (12h format)

Parameters

a (DateTime) –

Returns

Return type

int32

classmethod get_hours(a)int32

Returns the hours component of A

Parameters

a (Timespan) –

Returns

Return type

int32

classmethod get_max2d(a)float

Get the maximum value of the vector’s components.

Parameters

a (Vector2D) –

Returns

The maximum value of the vector’s components.

Return type

float

classmethod get_max_element(a)float

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

Parameters

a (Vector) –

Returns

Return type

float

classmethod get_millisecond(a)int32

Returns the millisecond component of A

Parameters

a (DateTime) –

Returns

Return type

int32

classmethod get_milliseconds(a)int32

Returns the milliseconds component of A

Parameters

a (Timespan) –

Returns

Return type

int32

classmethod get_min2d(a)float

Get the minimum value of the vector’s components.

Parameters

a (Vector2D) –

Returns

The minimum value of the vector’s components.

Return type

float

classmethod get_min_element(a)float

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

Parameters

a (Vector) –

Returns

Return type

float

classmethod get_minute(a)int32

Returns the minute component of A

Parameters

a (DateTime) –

Returns

Return type

int32

classmethod get_minutes(a)int32

Returns the minutes component of A

Parameters

a (Timespan) –

Returns

Return type

int32

classmethod get_month(a)int32

Returns the month component of A

Parameters

a (DateTime) –

Returns

Return type

int32

classmethod get_pi()float

Returns the value of PI

Returns

Return type

float

classmethod get_point_distance_to_line(point, line_origin, line_direction)float

Find the distance from a point to the closest point on an infinite line.

Parameters
  • point (Vector) – Point for which we find the distance to the closest point on the line.

  • line_origin (Vector) – Point of reference on the line.

  • line_direction (Vector) – Direction of the line. Not required to be normalized.

Returns

The distance from the given point to the closest point on the line.

Return type

float

classmethod get_point_distance_to_segment(point, segment_start, segment_end)float

Find the distance from a point to the closest point on a segment.

Parameters
  • point (Vector) – Point for which we find the distance to the closest point on the segment.

  • segment_start (Vector) – Start of the segment.

  • segment_end (Vector) – End of the segment.

Returns

The distance from the given point to the closest point on the segment.

Return type

float

classmethod get_reflection_vector(direction, 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
  • direction (Vector) – Direction vector the ray is coming from.

  • surface_normal (Vector) – A normal of the surface the ray should be reflected on.

Returns

Reflected vector.

Return type

Vector

classmethod get_right_vector(rot)Vector

Rotate the world right vector by the given rotation

Parameters

rot (Rotator) –

Returns

Return type

Vector

classmethod get_rotated2d(a, angle_deg)Vector2D

Rotates around axis (0,0,1)

Parameters
  • a (Vector2D) –

  • angle_deg (float) – Angle to rotate (in degrees)

Returns

Rotated Vector

Return type

Vector2D

classmethod get_second(a)int32

Returns the second component of A

Parameters

a (DateTime) –

Returns

Return type

int32

classmethod get_seconds(a)int32

Returns the seconds component of A

Parameters

a (Timespan) –

Returns

Return type

int32

classmethod get_slope_degree_angles(my_right_y_axis, floor_normal, up_vector) -> (out_slope_pitch_degree_angle=float, out_slope_roll_degree_angle=float)

Returns Slope Pitch and Roll angles in degrees based on the following information: outparam: OutSlopePitchDegreeAngle Slope Pitch angle (degrees) outparam: OutSlopeRollDegreeAngle Slope Roll angle (degrees)

Parameters
  • my_right_y_axis (Vector) – Right (Y) direction unit vector of Actor standing on Slope.

  • floor_normal (Vector) – Floor Normal (unit) vector.

  • up_vector (Vector) – UpVector of reference frame.

Returns

out_slope_pitch_degree_angle (float):

out_slope_roll_degree_angle (float):

Return type

tuple

classmethod get_tau()float

Returns the value of TAU (= 2 * PI)

Returns

Return type

float

classmethod get_time_of_day(a)Timespan

Returns the time elapsed since midnight of A

Parameters

a (DateTime) –

Returns

Return type

Timespan

classmethod get_total_days(a)float

Returns the total number of days in A

Parameters

a (Timespan) –

Returns

Return type

float

classmethod get_total_hours(a)float

Returns the total number of hours in A

Parameters

a (Timespan) –

Returns

Return type

float

classmethod get_total_milliseconds(a)float

Returns the total number of milliseconds in A

Parameters

a (Timespan) –

Returns

Return type

float

classmethod get_total_minutes(a)float

Returns the total number of minutes in A

Parameters

a (Timespan) –

Returns

Return type

float

classmethod get_total_seconds(a)float

Returns the total number of seconds in A

Parameters

a (Timespan) –

Returns

Return type

float

classmethod get_up_vector(rot)Vector

Rotate the world up vector by the given rotation

Parameters

rot (Rotator) –

Returns

Return type

Vector

classmethod get_vector_array_average(vectors)Vector

Find the average of an array of vectors

Parameters

vectors (Array(Vector)) –

Returns

Return type

Vector

classmethod get_year(a)int32

Returns the year component of A

Parameters

a (DateTime) –

Returns

Return type

int32

classmethod greater_byte_byte(a, b)bool

Returns true if A is greater than B (A > B)

Parameters
  • a (uint8) –

  • b (uint8) –

Returns

Return type

bool

classmethod greater_date_time_date_time(a, b)bool

Returns true if A is greater than B (A > B)

Parameters
Returns

Return type

bool

classmethod greater_equal_byte_byte(a, b)bool

Returns true if A is greater than or equal to B (A >= B)

Parameters
  • a (uint8) –

  • b (uint8) –

Returns

Return type

bool

classmethod greater_equal_date_time_date_time(a, b)bool

Returns true if A is greater than or equal to B (A >= B)

Parameters
Returns

Return type

bool

classmethod greater_equal_float_float(a, b)bool

Returns true if A is greater than or equal to B (A >= B)

Parameters
Returns

Return type

bool

classmethod greater_equal_int64_int64(a, b)bool

Returns true if A is greater than or equal to B (A >= B)

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

bool

classmethod greater_equal_int_int(a, b)bool

Returns true if A is greater than or equal to B (A >= B)

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

bool

classmethod greater_equal_timespan_timespan(a, b)bool

Returns true if A is greater than or equal to B (A >= B)

Parameters
Returns

Return type

bool

classmethod greater_float_float(a, b)bool

Returns true if A is greater than B (A > B)

Parameters
Returns

Return type

bool

classmethod greater_greater_vector_rotator(a, b)Vector

Returns result of vector A rotated by Rotator B

Parameters
Returns

Return type

Vector

classmethod greater_int64_int64(a, b)bool

Returns true if A is greater than B (A > B)

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

bool

classmethod greater_int_int(a, b)bool

Returns true if A is greater than B (A > B)

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

bool

classmethod greater_timespan_timespan(a, b)bool

Returns true if A is greater than B (A > B)

Parameters
Returns

Return type

bool

classmethod grid_snap_float(location, grid_size)float
Snaps a value to the nearest grid multiple. E.g.,

Location = 5.1, GridSize = 10.0 : return value = 10.0

If GridSize is 0 Location is returned if GridSize is very small precision issues may occur.

Parameters
Returns

Return type

float

classmethod hsv_to_rgb(h, s, v, a=1.0)LinearColor

Make a color from individual color components (HSV space; Hue is [0..360) while Saturation and Value are 0..1)

Parameters
Returns

Return type

LinearColor

classmethod hsv_to_rgb_linear(hsv)LinearColor

Converts a HSV linear color (where H is in R, S is in G, and V is in B) to linear RGB

Parameters

hsv (LinearColor) –

Returns

Return type

LinearColor

classmethod hsv_to_rgb_vector(hsv)LinearColor

Converts a HSV linear color (where H is in R (0..360), S is in G (0..1), and V is in B (0..1)) to RGB

Parameters

hsv (LinearColor) –

Returns

rgb (LinearColor):

Return type

LinearColor

classmethod hypotenuse(width, height)float

Returns the hypotenuse of a right-angled triangle given the width and height.

Parameters
Returns

Return type

float

classmethod in_range_float_float(value, min, max, inclusive_min=True, inclusive_max=True)bool

Returns true if value is between Min and Max (V >= Min && V <= Max) If InclusiveMin is true, value needs to be equal or larger than Min, else it needs to be larger If InclusiveMax is true, value needs to be smaller or equal than Max, else it needs to be smaller

Parameters
Returns

Return type

bool

classmethod in_range_int64_int64(value, min, max, inclusive_min=True, inclusive_max=True)bool

Returns true if value is between Min and Max (V >= Min && V <= Max) If InclusiveMin is true, value needs to be equal or larger than Min, else it needs to be larger If InclusiveMax is true, value needs to be smaller or equal than Max, else it needs to be smaller

Parameters
  • value (int64) –

  • min (int64) –

  • max (int64) –

  • inclusive_min (bool) –

  • inclusive_max (bool) –

Returns

Return type

bool

classmethod in_range_int_int(value, min, max, inclusive_min=True, inclusive_max=True)bool

Returns true if value is between Min and Max (V >= Min && V <= Max) If InclusiveMin is true, value needs to be equal or larger than Min, else it needs to be larger If InclusiveMax is true, value needs to be smaller or equal than Max, else it needs to be smaller

Parameters
  • value (int32) –

  • min (int32) –

  • max (int32) –

  • inclusive_min (bool) –

  • inclusive_max (bool) –

Returns

Return type

bool

classmethod inverse_lerp(value, range_min, range_max)

deprecated: ‘inverse_lerp’ was renamed to ‘normalize_to_range’.

classmethod inverse_transform_direction(t, direction)Vector

Transform a direction vector by the inverse of the supplied transform - will not change its length. For example, if T was an object’s transform, this would transform a direction from world space to local space.

Parameters
Returns

Return type

Vector

classmethod inverse_transform_location(t, location)Vector

Transform a position by the inverse of the supplied transform. For example, if T was an object’s transform, this would transform a position from world space to local space.

Parameters
Returns

Return type

Vector

classmethod inverse_transform_position(t, location)

deprecated: ‘inverse_transform_position’ was renamed to ‘inverse_transform_location’.

classmethod inverse_transform_rotation(t, rotation)Rotator

Transform a rotator by the inverse of the supplied transform. For example, if T was an object’s transform, this would transform a rotation from world space to local space.

Parameters
Returns

Return type

Rotator

classmethod invert_transform(t)Transform

Returns the inverse of the given transform T.

Example: Given a LocalToWorld transform, WorldToLocal will be returned.

Parameters

t (Transform) – The transform you wish to invert

Returns

The inverse of T.

Return type

Transform

classmethod is_afternoon(a)bool

Returns whether A’s time is in the afternoon

Parameters

a (DateTime) –

Returns

Return type

bool

classmethod is_leap_year(year)bool

Returns whether given year is a leap year

Parameters

year (int32) –

Returns

Return type

bool

classmethod is_morning(a)bool

Returns whether A’s time is in the morning

Parameters

a (DateTime) –

Returns

Return type

bool

classmethod is_nearly_zero2d(a, tolerance=0.0001)bool

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

Parameters
Returns

true if vector is in tolerance to zero, otherwise false.

Return type

bool

classmethod is_point_in_box(point, box_origin, box_extent)bool

Determines whether the given point is in a box. Includes points on the box.

Parameters
  • point (Vector) – Point to test

  • box_origin (Vector) – Origin of the box

  • box_extent (Vector) – Extents of the box (distance in each axis from origin)

Returns

Whether the point is in the box.

Return type

bool

classmethod is_point_in_box_with_transform(point, box_world_transform, box_extent)bool

Determines whether a given point is in a box with a given transform. Includes points on the box.

Parameters
  • point (Vector) – Point to test

  • box_world_transform (Transform) – Component-to-World transform of the box.

  • box_extent (Vector) – Extents of the box (distance in each axis from origin), in component space.

Returns

Whether the point is in the box.

Return type

bool

classmethod is_zero2d(a)bool

Checks whether all components of the vector are exactly zero.

Parameters

a (Vector2D) –

Returns

true if vector is exactly zero, otherwise false.

Return type

bool

classmethod lerp(a, b, alpha)float

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

Parameters
Returns

Return type

float

classmethod less_byte_byte(a, b)bool

Returns true if A is less than B (A < B)

Parameters
  • a (uint8) –

  • b (uint8) –

Returns

Return type

bool

classmethod less_date_time_date_time(a, b)bool

Returns true if A is less than B (A < B)

Parameters
Returns

Return type

bool

classmethod less_equal_byte_byte(a, b)bool

Returns true if A is less than or equal to B (A <= B)

Parameters
  • a (uint8) –

  • b (uint8) –

Returns

Return type

bool

classmethod less_equal_date_time_date_time(a, b)bool

Returns true if A is less than or equal to B (A <= B)

Parameters
Returns

Return type

bool

classmethod less_equal_float_float(a, b)bool

Returns true if A is Less than or equal to B (A <= B)

Parameters
Returns

Return type

bool

classmethod less_equal_int64_int64(a, b)bool

Returns true if A is less than or equal to B (A <= B)

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

bool

classmethod less_equal_int_int(a, b)bool

Returns true if A is less than or equal to B (A <= B)

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

bool

classmethod less_equal_timespan_timespan(a, b)bool

Returns true if A is less than or equal to B (A <= B)

Parameters
Returns

Return type

bool

classmethod less_float_float(a, b)bool

Returns true if A is Less than B (A < B)

Parameters
Returns

Return type

bool

classmethod less_int64_int64(a, b)bool

Returns true if A is less than B (A < B)

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

bool

classmethod less_int_int(a, b)bool

Returns true if A is less than B (A < B)

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

bool

classmethod less_less_vector_rotator(a, b)Vector

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

Parameters
Returns

Return type

Vector

classmethod less_timespan_timespan(a, b)bool

Returns true if A is less than B (A < B)

Parameters
Returns

Return type

bool

classmethod line_plane_intersection(line_start, line_end, a_plane)(t=float, intersection=Vector) or None

Computes the intersection point between a line and a plane.

Parameters
Returns

True if the intersection test was successful.

t (float): The t of the intersection between the line and the plane

intersection (Vector): The point of intersection between the line and the plane

Return type

tuple or None

classmethod line_plane_intersection_origin_normal(line_start, line_end, plane_origin, plane_normal)(t=float, intersection=Vector) or None

Computes the intersection point between a line and a plane.

Parameters
Returns

True if the intersection test was successful.

t (float): The t of the intersection between the line and the plane

intersection (Vector): The point of intersection between the line and the plane

Return type

tuple or None

classmethod linear_color_desaturated(color, desaturation)LinearColor

Returns a desaturated color, with 0 meaning no desaturation and 1 == full desaturation

Parameters
Returns

Desaturated color

Return type

LinearColor

classmethod linear_color_distance(c1, c2)float

Euclidean distance between two color points.

Parameters
Returns

Return type

float

classmethod linear_color_get_luminance(color)float

Returns the perceived brightness of a color on a display taking into account the impact on the human eye per color channel: green > red > blue.

Parameters

color (LinearColor) –

Returns

Return type

float

classmethod linear_color_get_max(color)float

Returns the maximum color channel value in this color structure

Parameters

color (LinearColor) –

Returns

The maximum color channel value

Return type

float

classmethod linear_color_get_min(color)float

Returns the minimum color channel value in this color structure

Parameters

color (LinearColor) –

Returns

The minimum color channel value

Return type

float

classmethod linear_color_is_near_equal(a, b, tolerance=0.0001)bool

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

Parameters
Returns

Return type

bool

classmethod linear_color_lerp(a, b, alpha)LinearColor

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

Parameters
Returns

Return type

LinearColor

classmethod linear_color_lerp_using_hsv(a, b, alpha)LinearColor

Linearly interpolates between two colors by the specified Alpha amount (100% of A when Alpha=0 and 100% of B when Alpha=1). The interpolation is performed in HSV color space taking the shortest path to the new color’s hue. This can give better results than a normal lerp, but is much more expensive. The incoming colors are in RGB space, and the output color will be RGB. The alpha value will also be interpolated.

Parameters
  • a (LinearColor) – The color and alpha to interpolate from as linear RGBA

  • b (LinearColor) – The color and alpha to interpolate to as linear RGBA

  • alpha (float) – Scalar interpolation amount (usually between 0.0 and 1.0 inclusive)

Returns

The interpolated color in linear RGB space along with the interpolated alpha value

Return type

LinearColor

classmethod linear_color_quantize(color)Color

Quantizes the linear color and returns the result as an 8-bit color. This bypasses the SRGB conversion.

Parameters

color (LinearColor) –

Returns

Return type

Color

classmethod linear_color_quantize_round(color)Color

Quantizes the linear color with rounding and returns the result as an 8-bit color. This bypasses the SRGB conversion.

Parameters

color (LinearColor) –

Returns

Return type

Color

classmethod linear_color_set(out_color, color)LinearColor

Assign contents of InColor

Parameters
Returns

out_color (LinearColor):

Return type

LinearColor

classmethod linear_color_set_from_hsv(out_color, h, s, v, a=1.0)LinearColor

Assigns an HSV color to a linear space RGB color

Parameters
Returns

out_color (LinearColor):

Return type

LinearColor

classmethod linear_color_set_from_pow22(out_color, color)LinearColor

Assigns an FColor coming from an observed Pow(1/2.2) output, into a linear color.

Parameters
  • out_color (LinearColor) –

  • color (Color) – The Pow(1/2.2) color that needs to be converted into linear space.

Returns

out_color (LinearColor):

Return type

LinearColor

classmethod linear_color_set_from_srgb(out_color, srgb)LinearColor

Assigns an FColor coming from an observed sRGB output, into a linear color.

Parameters
  • out_color (LinearColor) –

  • srgb (Color) – The sRGB color that needs to be converted into linear space.

Returns

out_color (LinearColor):

Return type

LinearColor

classmethod linear_color_set_random_hue(out_color)LinearColor

Sets to a random color. Choses a quite nice color based on a random hue.

Parameters

out_color (LinearColor) –

Returns

out_color (LinearColor):

Return type

LinearColor

classmethod linear_color_set_rgba(out_color, r, g, b, a=1.0)LinearColor

Assign individual linear RGBA components.

Parameters
Returns

out_color (LinearColor):

Return type

LinearColor

classmethod linear_color_set_temperature(out_color, temperature)LinearColor

Converts temperature in Kelvins of a black body radiator to RGB chromaticity.

Parameters
Returns

out_color (LinearColor):

Return type

LinearColor

classmethod linear_color_to_new_opacity(color, opacity)LinearColor

Returns a copy of this color using the specified opacity/alpha.

Parameters
Returns

Return type

LinearColor

classmethod linear_color_to_rgbe(linear_color)Color

Convert from linear to 8-bit RGBE as outlined in Gregory Ward’s Real Pixels article, Graphics Gems II, page 80.

Parameters

linear_color (LinearColor) –

Returns

Return type

Color

classmethod log(a, base=1.0)float

Returns log of A base B (if B^R == A, returns R)

Parameters
Returns

Return type

float

classmethod loge(a)float

Returns natural log of A (if e^R == A, returns R)

Parameters

a (float) –

Returns

Return type

float

classmethod make_plane_from_point_and_normal(point, normal)Plane

Creates a plane with a facing direction of Normal at the given Point

Parameters
  • point (Vector) – A point on the plane

  • normal (Vector) – The Normal of the plane at Point

Returns

Plane instance

Return type

Plane

classmethod make_pulsating_value(current_time, pulses_per_second=1.0, phase=0.0)float

Simple function to create a pulsating scalar value

Parameters
  • current_time (float) – Current absolute time

  • pulses_per_second (float) – How many full pulses per second?

  • phase (float) – Optional phase amount, between 0.0 and 1.0 (to synchronize pulses)

Returns

Pulsating value (0.0-1.0)

Return type

float

classmethod make_relative_transform(a, relative_to)Transform

Computes a relative transform of one transform compared to another.

Example: ChildOffset = MakeRelativeTransform(Child.GetActorTransform(), Parent.GetActorTransform()) This computes the relative transform of the Child from the Parent.

Parameters
  • a (Transform) – The object’s transform

  • relative_to (Transform) – The transform the result is relative to (in the same space as A)

Returns

The new relative transform

Return type

Transform

classmethod make_rot_from_x(x)Rotator

Builds a rotator given only a XAxis. Y and Z are unspecified but will be orthonormal. XAxis need not be normalized.

Parameters

x (Vector) –

Returns

Return type

Rotator

classmethod make_rot_from_xy(x, y)Rotator

Builds a matrix with given X and Y axes. X will remain fixed, Y may be changed minimally to enforce orthogonality. Z will be computed. Inputs need not be normalized.

Parameters
Returns

Return type

Rotator

classmethod make_rot_from_xz(x, z)Rotator

Builds a matrix with given X and Z axes. X will remain fixed, Z may be changed minimally to enforce orthogonality. Y will be computed. Inputs need not be normalized.

Parameters
Returns

Return type

Rotator

classmethod make_rot_from_y(y)Rotator

Builds a rotation matrix given only a YAxis. X and Z are unspecified but will be orthonormal. YAxis need not be normalized.

Parameters

y (Vector) –

Returns

Return type

Rotator

classmethod make_rot_from_yx(y, x)Rotator

Builds a matrix with given Y and X axes. Y will remain fixed, X may be changed minimally to enforce orthogonality. Z will be computed. Inputs need not be normalized.

Parameters
Returns

Return type

Rotator

classmethod make_rot_from_yz(y, z)Rotator

Builds a matrix with given Y and Z axes. Y will remain fixed, Z may be changed minimally to enforce orthogonality. X will be computed. Inputs need not be normalized.

Parameters
Returns

Return type

Rotator

classmethod make_rot_from_z(z)Rotator

Builds a rotation matrix given only a ZAxis. X and Y are unspecified but will be orthonormal. ZAxis need not be normalized.

Parameters

z (Vector) –

Returns

Return type

Rotator

classmethod make_rot_from_zx(z, x)Rotator

Builds a matrix with given Z and X axes. Z will remain fixed, X may be changed minimally to enforce orthogonality. Y will be computed. Inputs need not be normalized.

Parameters
Returns

Return type

Rotator

classmethod make_rot_from_zy(z, y)Rotator

Builds a matrix with given Z and Y axes. Z will remain fixed, Y may be changed minimally to enforce orthogonality. X will be computed. Inputs need not be normalized.

Parameters
Returns

Return type

Rotator

classmethod make_rotation_from_axes(forward, right, up)Rotator

Build a reference frame from three axes

Parameters
Returns

Return type

Rotator

classmethod map_range(value, range_a, range_b, out_range_a, out_range_b)

deprecated: ‘map_range’ was renamed to ‘map_range_unclamped’.

classmethod map_range_clamped(value, range_a, range_b, out_range_a, out_range_b)float

Returns Value mapped from one range into another where the Value is clamped to the Input Range. (e.g. 0.5 normalized from the range 0->1 to 0->50 would result in 25)

Parameters
Returns

Return type

float

classmethod map_range_unclamped(value, range_a, range_b, out_range_a, out_range_b)float

Returns Value mapped from one range into another. (e.g. 20 normalized from the range 10->50 to 20->40 would result in 25)

Parameters
Returns

Return type

float

classmethod matrix_apply_scale(m, scale)Matrix

Apply Scale to this matrix (Assumes Matrix represents a transform)

Parameters
Returns

Return type

Matrix

classmethod matrix_concatenate_translation(m, translation)Matrix

Returns a matrix with an additional translation concatenated. (Assumes Matrix represents a transform)

Parameters
Returns

Return type

Matrix

classmethod matrix_contains_na_n(m)bool

Returns true if any element of this matrix is NaN

Parameters

m (Matrix) –

Returns

Return type

bool

classmethod matrix_get_column(m, column)Vector

get a column of this matrix

Parameters
Returns

vector of the column

Return type

Vector

classmethod matrix_get_determinant(m)float
Parameters

m (Matrix) –

Returns

determinant of this matrix.

Return type

float

classmethod matrix_get_frustum_bottom_plane(m)Plane or None

Get the bottom plane of the Frustum of this matrix (Assumes Matrix represents a View Projection Matrix)

Parameters

m (Matrix) –

Returns

out_plane (Plane): the bottom plane of the Frustum of this matrix

Return type

Plane or None

classmethod matrix_get_frustum_far_plane(m)Plane or None

Get the far plane of the Frustum of this matrix (Assumes Matrix represents a View Projection Matrix)

Parameters

m (Matrix) –

Returns

out_plane (Plane): the far plane of the Frustum of this matrix

Return type

Plane or None

classmethod matrix_get_frustum_left_plane(m)Plane or None

Get the left plane of the Frustum of this matrix (Assumes Matrix represents a View Projection Matrix)

Parameters

m (Matrix) –

Returns

out_plane (Plane): the left plane of the Frustum of this matrix

Return type

Plane or None

classmethod matrix_get_frustum_near_plane(m)Plane or None

Get the near plane of the Frustum of this matrix (Assumes Matrix represents a View Projection Matrix)

Parameters

m (Matrix) –

Returns

out_plane (Plane): the near plane of the Frustum of this matrix

Return type

Plane or None

classmethod matrix_get_frustum_right_plane(m)Plane or None

Get the right plane of the Frustum of this matrix (Assumes Matrix represents a View Projection Matrix)

Parameters

m (Matrix) –

Returns

out_plane (Plane): the right plane of the Frustum of this matrix

Return type

Plane or None

classmethod matrix_get_frustum_top_plane(m)Plane or None

Get the top plane of the Frustum of this matrix (Assumes Matrix represents a View Projection Matrix)

Parameters

m (Matrix) –

Returns

out_plane (Plane): the top plane of the Frustum of this matrix

Return type

Plane or None

classmethod matrix_get_inverse(m)Matrix

Get the inverse of the Matrix. Handles nil matrices.

Parameters

m (Matrix) –

Returns

Return type

Matrix

classmethod matrix_get_matrix_without_scale(m, tolerance=0.0)Matrix

Returns matrix after RemoveScaling with error Tolerance (Assumes Matrix represents a transform)

Parameters
Returns

Return type

Matrix

classmethod matrix_get_maximum_axis_scale(m)float
Parameters

m (Matrix) –

Returns

the maximum magnitude of any row of the matrix. (Assumes Matrix represents a transform)

Return type

float

classmethod matrix_get_origin(matrix)Vector

Get the origin of the co-ordinate system (Assumes Matrix represents a transform)

Parameters

matrix (Matrix) –

Returns

co-ordinate system origin

Return type

Vector

classmethod matrix_get_rot_determinant(m)float
Parameters

m (Matrix) –

Returns

the determinant of rotation 3x3 matrix (Assumes Top Left 3x3 Submatrix represents a Rotation)

Return type

float

classmethod matrix_get_rotator(m)Rotator

Get the rotator representation of this matrix (Assumes Matrix represents a transform)

Parameters

m (Matrix) –

Returns

rotator representation of this matrix

Return type

Rotator

classmethod matrix_get_scale_vector(m, tolerance=0.0)Vector

return a 3D scale vector calculated from this matrix (where each component is the magnitude of a row vector) with error Tolerance. (Assumes Matrix represents a transform)

Parameters
Returns

Return type

Vector

classmethod matrix_get_scaled_axes(m) -> (x=Vector, y=Vector, z=Vector)

get axes of this matrix scaled by the scale of the matrix (Assumes Matrix represents a transform)

Parameters

m (Matrix) –

Returns

x (Vector): axes returned to this param

y (Vector): axes returned to this param

z (Vector): axes returned to this param

Return type

tuple

classmethod matrix_get_scaled_axis(m, axis)Vector

get axis of this matrix scaled by the scale of the matrix (Assumes Matrix represents a transform)

Parameters
Returns

vector of the axis

Return type

Vector

classmethod matrix_get_transpose_adjoint(m)Matrix

Get the Transose Adjoint of the Matrix.

Parameters

m (Matrix) –

Returns

Return type

Matrix

classmethod matrix_get_transposed(m)Matrix

Transpose.

Parameters

m (Matrix) –

Returns

Return type

Matrix

classmethod matrix_get_unit_axes(m) -> (x=Vector, y=Vector, z=Vector)

get unit length axes of this matrix (Assumes Matrix represents a transform)

Parameters

m (Matrix) –

Returns

x (Vector): axes returned to this param

y (Vector): axes returned to this param

z (Vector): axes returned to this param

Return type

tuple

classmethod matrix_get_unit_axis(m, axis)Vector

get unit length axis of this matrix (Assumes Matrix represents a transform)

Parameters
Returns

vector of the axis

Return type

Vector

classmethod matrix_inverse_transform_position(m, v)Vector

Inverts the matrix and then transforms V - correctly handles scaling in this matrix. (Assumes Matrix represents a transform)

Parameters
Returns

Return type

Vector

classmethod matrix_inverse_transform_vector(m, v)Vector

Transform a direction vector by the inverse of this matrix - will not take into account translation part. If you want to transform a surface normal (or plane) and correctly account for non-uniform scaling you should use TransformByUsingAdjointT with adjoint of matrix inverse. (Assumes Matrix represents a transform)

Parameters
Returns

Return type

Vector

classmethod matrix_mirror(m, mirror_axis, flip_axis)Matrix

Utility for mirroring this transform across a certain plane, and flipping one of the axis as well. (Assumes Matrix represents a transform)

Parameters
Returns

Return type

Matrix

classmethod matrix_remove_scaling(m, tolerance=0.0)Matrix

Remove any scaling from this matrix (ie magnitude of each row is 1) with error Tolerance (Assumes Matrix represents a transform)

Parameters
Returns

m (Matrix):

Return type

Matrix

classmethod matrix_remove_translation(m)Matrix

Remove any translation from this matrix (Assumes Matrix represents a transform)

Parameters

m (Matrix) –

Returns

Return type

Matrix

classmethod matrix_scale_translation(m, scale3d)Matrix

Scale the translation part of the matrix by the supplied vector. (Assumes Matrix represents a transform)

Parameters
Returns

Return type

Matrix

classmethod matrix_set_axis(m, axis, axis_vector)Matrix

set an axis of this matrix (Assumes Matrix represents a transform)

Parameters
Returns

m (Matrix):

Return type

Matrix

classmethod matrix_set_column(m, column, value)Matrix

Matrix Set Column

Parameters
Returns

m (Matrix):

Return type

Matrix

classmethod matrix_set_origin(m, new_origin)Matrix

Set the origin of the coordinate system to the given vector (Assumes Matrix represents a transform)

Parameters
Returns

m (Matrix):

Return type

Matrix

classmethod matrix_to_quat(m)Quat

Transform a rotation matrix into a quaternion. (Assumes Matrix represents a transform) warning: rotation part will need to be unit length for this to be right!

Parameters

m (Matrix) –

Returns

Return type

Quat

classmethod matrix_transform_position(m, v)Vector4

Transform a location - will take into account translation part of the FMatrix. (Assumes Matrix represents a transform)

Parameters
Returns

Return type

Vector4

classmethod matrix_transform_vector(m, v)Vector4

Transform a direction vector - will not take into account translation part of the FMatrix. If you want to transform a surface normal (or plane) and correctly account for non-uniform scaling you should use TransformByUsingAdjointT. (Assumes Matrix represents a transform)

Parameters
Returns

Return type

Vector4

classmethod matrix_transform_vector4(m, v)Vector4

Transform a vector by the matrix. (Assumes Matrix represents a transform)

Parameters
Returns

Return type

Vector4

classmethod max(a, b)int32

Returns the maximum value of A and B

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

int32

classmethod max_int64(a, b)int64

Returns the maximum value of A and B

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

int64

classmethod max_of_byte_array(byte_array) -> (index_of_max_value=int32, max_value=uint8)

Returns max of all array entries and the index at which it was found. Returns value of 0 and index of -1 if the supplied array is empty.

Parameters

byte_array (Array(uint8)) –

Returns

index_of_max_value (int32):

max_value (uint8):

Return type

tuple

classmethod max_of_float_array(float_array) -> (index_of_max_value=int32, max_value=float)

Returns max of all array entries and the index at which it was found. Returns value of 0 and index of -1 if the supplied array is empty.

Parameters

float_array (Array(float)) –

Returns

index_of_max_value (int32):

max_value (float):

Return type

tuple

classmethod max_of_int_array(int_array) -> (index_of_max_value=int32, max_value=int32)

Returns max of all array entries and the index at which it was found. Returns value of 0 and index of -1 if the supplied array is empty.

Parameters

int_array (Array(int32)) –

Returns

index_of_max_value (int32):

max_value (int32):

Return type

tuple

classmethod min(a, b)int32

Returns the minimum value of A and B

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

int32

classmethod min_int64(a, b)int64

Returns the minimum value of A and B

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

int64

classmethod min_of_byte_array(byte_array) -> (index_of_min_value=int32, min_value=uint8)

Returns min of all array entries and the index at which it was found. Returns value of 0 and index of -1 if the supplied array is empty.

Parameters

byte_array (Array(uint8)) –

Returns

index_of_min_value (int32):

min_value (uint8):

Return type

tuple

classmethod min_of_float_array(float_array) -> (index_of_min_value=int32, min_value=float)

Returns min of all array entries and the index at which it was found. Returns value of 0 and index of -1 if the supplied array is empty.

Parameters

float_array (Array(float)) –

Returns

index_of_min_value (int32):

min_value (float):

Return type

tuple

classmethod min_of_int_array(int_array) -> (index_of_min_value=int32, min_value=int32)

Returns min of all array entries and the index at which it was found. Returns value of 0 and index of -1 if the supplied array is empty.

Parameters

int_array (Array(int32)) –

Returns

index_of_min_value (int32):

min_value (int32):

Return type

tuple

classmethod minimum_area_rectangle(world_context_object, verts, sample_surface_normal, debug_draw=False) -> (out_rect_center=Vector, out_rect_rotation=Rotator, out_side_length_x=float, out_side_length_y=float)

Finds the minimum area rectangle that encloses all of the points in InVerts Uses algorithm found in http://www.geometrictools.com/Documentation/MinimumAreaRectangle.pdf outparam: OutRectCenter - Center of the enclosing rectangle outparam: OutRectSideA - Vector oriented and sized to represent one edge of the enclosing rectangle, orthogonal to OutRectSideB outparam: OutRectSideB - Vector oriented and sized to represent one edge of the enclosing rectangle, orthogonal to OutRectSideA

Parameters
  • world_context_object (Object) –

  • verts (Array(Vector)) – Points to enclose in the rectangle

  • sample_surface_normal (Vector) –

  • debug_draw (bool) –

Returns

out_rect_center (Vector):

out_rect_rotation (Rotator):

out_side_length_x (float):

out_side_length_y (float):

Return type

tuple

classmethod mirror_vector_by_normal(vect, 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
  • vect (Vector) – Direction vector the ray is coming from.

  • normal (Vector) – A normal of the surface the ray should be reflected on.

Returns

Reflected vector.

Return type

Vector

classmethod multiply_by_pi(value)float

Multiplies the input value by pi.

Parameters

value (float) –

Returns

Return type

float

classmethod multiply_byte_byte(a, b)uint8

Multiplication (A * B)

Parameters
  • a (uint8) –

  • b (uint8) –

Returns

Return type

uint8

classmethod multiply_float_float(a, b)float

Multiplication (A * B)

Parameters
Returns

Return type

float

classmethod multiply_int64_int64(a, b)int64

Multiplication (A * B)

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

int64

classmethod multiply_int_float(a, b)float

Multiplication (A * B)

Parameters
  • a (int32) –

  • b (float) –

Returns

Return type

float

classmethod multiply_int_int(a, b)int32

Multiplication (A * B)

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

int32

classmethod multiply_int_point_int(a, b)IntPoint

Multiplication (A * B)

Parameters
Returns

Return type

IntPoint

classmethod multiply_int_point_int_point(a, b)IntPoint

Returns IntPoint A multiplied by B

Parameters
Returns

Return type

IntPoint

classmethod multiply_linear_color_float(a, b)LinearColor

Element-wise multiplication of a linear color by a float (F*R, F*G, F*B, F*A)

Parameters
Returns

Return type

LinearColor

classmethod multiply_linear_color_linear_color(a, b)LinearColor

Element-wise multiplication of two linear colors (R*R, G*G, B*B, A*A)

Parameters
Returns

Return type

LinearColor

classmethod multiply_matrix_float(a, b)Matrix

Multiplies all values of the matrix by a float. If your Matrix represents a Transform that you wish to scale you should use Apply Scale instead

Parameters
Returns

Return type

Matrix

classmethod multiply_matrix_matrix(a, b)Matrix

Gets the result of multiplying a Matrix to this.

Parameters
Returns

The result of multiplication.

Return type

Matrix

classmethod multiply_multiply_float_float(base, exp)float

Power (Base to the Exp-th power)

Parameters
Returns

Return type

float

classmethod multiply_quat_quat(a, b)Quat

Gets the result of multiplying two quaternions (A * B).

Order matters when composing quaternions: C = A * B will yield a quaternion C that logically first applies B then A to any subsequent transformation (right first, then left).

Parameters
  • a (Quat) –

  • b (Quat) – The Quaternion to multiply by.

Returns

The result of multiplication (A * B).

Return type

Quat

classmethod multiply_rotator_float(a, b)Rotator

Returns rotator representing rotator A scaled by B

Parameters
Returns

Return type

Rotator

classmethod multiply_rotator_int(a, b)Rotator

Returns rotator representing rotator A scaled by B

Parameters
Returns

Return type

Rotator

classmethod multiply_timespan_float(a, scalar)Timespan

Scalar multiplication (A * s)

Parameters
Returns

Return type

Timespan

classmethod multiply_vector2d_float(a, b)Vector2D

Returns Vector A scaled by B

Parameters
Returns

Return type

Vector2D

classmethod multiply_vector2d_vector2d(a, b)Vector2D

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

Parameters
Returns

Return type

Vector2D

classmethod multiply_vector4_vector4(a, b)Vector4

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

Parameters
Returns

Return type

Vector4

classmethod multiply_vector_float(a, b)Vector

Scales Vector A by B

Parameters
Returns

Return type

Vector

classmethod multiply_vector_int(a, b)Vector

Scales Vector A by B

Parameters
  • a (Vector) –

  • b (int32) –

Returns

Return type

Vector

classmethod multiply_vector_vector(a, b)Vector

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

Parameters
Returns

Return type

Vector

classmethod nearly_equal_float_float(a, b, error_tolerance=1e-06)bool

Returns true if A is nearly equal to B (|A - B| < ErrorTolerance)

Parameters
Returns

Return type

bool

classmethod nearly_equal_rotator_rotator(a, b, error_tolerance=0.0001)

deprecated: ‘nearly_equal_rotator_rotator’ was renamed to ‘equal_equal_rotator_rotator’.

classmethod nearly_equal_transform_transform(a, b, location_tolerance=0.0001, rotation_tolerance=0.0001, scale3d_tolerance=0.0001)bool

Returns true if transform A is nearly equal to B

Parameters
  • a (Transform) –

  • b (Transform) –

  • location_tolerance (float) – How close position of transforms need to be to be considered equal

  • rotation_tolerance (float) – How close rotations of transforms need to be to be considered equal

  • scale3d_tolerance (float) – How close scale of transforms need to be to be considered equal

Returns

Return type

bool

classmethod nearly_equal_vector_vector(a, b, error_tolerance=0.0001)

deprecated: ‘nearly_equal_vector_vector’ was renamed to ‘equal_equal_vector_vector’.

classmethod negate_rotator(a)Rotator

Negate a rotator

Parameters

a (Rotator) –

Returns

Return type

Rotator

classmethod negate_vector(a)Vector

Negate a vector.

Parameters

a (Vector) –

Returns

Return type

Vector

classmethod negated2d(a)Vector2D

Gets a negated copy of the vector.

Parameters

a (Vector2D) –

Returns

Return type

Vector2D

classmethod normal(a, tolerance=0.0001)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
  • a (Vector) –

  • tolerance (float) – Minimum squared vector length.

Returns

A normalized copy if safe, (0,0,0) otherwise.

Return type

Vector

classmethod normal2d(a)Vector2D

Returns a unit normal version of the 2D vector

Parameters

a (Vector2D) –

Returns

Return type

Vector2D

classmethod normal_safe2d(a, tolerance=0.0)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
  • a (Vector2D) –

  • tolerance (float) – Minimum squared length of vector for normalization.

Returns

A normalized copy of the vector if safe, (0,0) otherwise.

Return type

Vector2D

classmethod normalize2d(a, tolerance=0.0)Vector2D

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

Parameters
  • a (Vector2D) –

  • tolerance (float) – Minimum squared length of vector for normalization.

Returns

a (Vector2D):

Return type

Vector2D

classmethod normalize_axis(angle)float

Clamps an angle to the range of [-180, 180].

Parameters

angle (float) – The Angle to clamp.

Returns

The clamped angle.

Return type

float

classmethod normalize_to_range(value, range_min, range_max)float

Returns Value normalized to the given range. (e.g. 20 normalized to the range 10->50 would result in 0.25)

Parameters
Returns

Return type

float

classmethod normalized_delta_rotator(a, b)Rotator

Normalized A-B

Parameters
Returns

Return type

Rotator

classmethod not_equal_bool_bool(a, b)bool

Returns true if the values are not equal (A != B)

Parameters
Returns

Return type

bool

classmethod not_equal_byte_byte(a, b)bool

Returns true if A is not equal to B (A != B)

Parameters
  • a (uint8) –

  • b (uint8) –

Returns

Return type

bool

classmethod not_equal_class_class(a, b)bool

Returns true if A and B are not equal (A != B)

Parameters
Returns

Return type

bool

classmethod not_equal_date_time_date_time(a, b)bool

Returns true if the values are not equal (A != B)

Parameters
Returns

Return type

bool

classmethod not_equal_exactly_vector2d_vector2d(a, b)bool

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

Parameters
Returns

Return type

bool

classmethod not_equal_exactly_vector4_vector4(a, b)bool

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

Parameters
Returns

Return type

bool

classmethod not_equal_exactly_vector_vector(a, b)bool

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

Parameters
Returns

Return type

bool

classmethod not_equal_float_float(a, b)bool

Returns true if A does not equal B (A != B)

Parameters
Returns

Return type

bool

classmethod not_equal_int64_int64(a, b)bool

Returns true if A is not equal to B (A != B)

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

bool

classmethod not_equal_int_int(a, b)bool

Returns true if A is not equal to B (A != B)

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

bool

classmethod not_equal_int_point_int_point(a, b)bool

Returns true if IntPoint A is NOT equal to IntPoint B (A != B)

Parameters
Returns

Return type

bool

classmethod not_equal_linear_color_linear_color(a, b)bool

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

Parameters
Returns

Return type

bool

classmethod not_equal_matrix_matrix(a, b, tolerance=0.0001)bool

Checks whether another Matrix is not equal to this, within specified tolerance.

Parameters
Returns

true if two Matrix are not equal, within specified tolerance, otherwise false.

Return type

bool

classmethod not_equal_name_name(a, b)bool

Returns true if A and B are not equal (A != B)

Parameters
Returns

Return type

bool

classmethod not_equal_object_object(a, b)bool

Returns true if A and B are not equal (A != B)

Parameters
Returns

Return type

bool

classmethod not_equal_quat_quat(a, b, error_tolerance=0.0001)bool

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

Parameters
Returns

Return type

bool

classmethod not_equal_rotator_rotator(a, b, error_tolerance=0.0001)bool

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

Parameters
Returns

Return type

bool

classmethod not_equal_timespan_timespan(a, b)bool

Returns true if the values are not equal (A != B)

Parameters
Returns

Return type

bool

classmethod not_equal_vector2d_vector2d(a, b, error_tolerance=0.0001)bool

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

Parameters
Returns

Return type

bool

classmethod not_equal_vector4_vector4(a, b, error_tolerance=0.0001)bool

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

Parameters
Returns

Return type

bool

classmethod not_equal_vector_vector(a, b, error_tolerance=0.0001)bool

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

Parameters
Returns

Return type

bool

classmethod not_int(a)int32

Bitwise NOT (~A)

Parameters

a (int32) –

Returns

Return type

int32

classmethod not_int64(a)int64

Bitwise NOT (~A)

Parameters

a (int64) –

Returns

Return type

int64

classmethod not_pre_bool(a)bool

Returns the logical complement of the Boolean value (NOT A)

Parameters

a (bool) –

Returns

Return type

bool

classmethod now()DateTime

Returns the local date and time on this computer

Returns

Return type

DateTime

classmethod or_int64_int64(a, b)int64

Bitwise OR (A | B)

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

int64

classmethod or_int_int(a, b)int32

Bitwise OR (A | B)

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

int32

classmethod percent_byte_byte(a, b=1)uint8

Modulo (A % B)

Parameters
  • a (uint8) –

  • b (uint8) –

Returns

Return type

uint8

classmethod percent_int_int(a, b=1)int32

Modulo (A % B)

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

int32

classmethod perlin_noise1d(value)float

Generates a 1D Perlin noise from the given value. Returns a continuous random value between -1.0 and 1.0.

Parameters

value (float) – The input value that Perlin noise will be generated from. This is usually a steadily incrementing time value.

Returns

Perlin noise in the range of -1.0 to 1.0

Return type

float

classmethod points_are_coplanar(points, tolerance=0.1)bool

Determines whether a given set of points are coplanar, with a tolerance. Any three points or less are always coplanar.

Parameters
  • points (Array(Vector)) – The set of points to determine coplanarity for.

  • tolerance (float) – Larger numbers means more variance is allowed.

Returns

Whether the points are relatively coplanar, based on the tolerance

Return type

bool

classmethod project_on_to(v, target)

deprecated: ‘project_on_to’ was renamed to ‘project_vector_on_to_vector’.

classmethod project_point_on_to_plane(point, plane_base, plane_normal)Vector

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

Parameters
  • point (Vector) – Point to project onto the plane.

  • plane_base (Vector) – A point on the plane.

  • plane_normal (Vector) – Normal of the plane.

Returns

Point projected onto the plane.

Return type

Vector

classmethod project_vector_on_to_plane(v, plane_normal)Vector

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

Parameters
  • v (Vector) – Vector to project onto the plane.

  • plane_normal (Vector) – Normal of the plane.

Returns

Vector projected onto the plane.

Return type

Vector

classmethod project_vector_on_to_vector(v, 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
  • v (Vector) – Vector to project.

  • target (Vector) – Vector on which we are projecting.

Returns

V projected on to Target.

Return type

Vector

classmethod quat_angular_distance(a, b)float

Find the angular distance/difference between two rotation quaternions.

Parameters
  • a (Quat) –

  • b (Quat) – Quaternion to find angle distance to

Returns

angular distance in radians

Return type

float

classmethod quat_enforce_shortest_arc_with(a, b)Quat

Modify the quaternion to ensure that the delta between it and B represents the shortest possible rotation angle.

Parameters
Returns

a (Quat):

Return type

Quat

classmethod quat_euler(q)Vector

Convert a Quaternion into floating-point Euler angles (in degrees).

Parameters

q (Quat) –

Returns

Return type

Vector

classmethod quat_exp(q)Quat

Used in combination with Log(). Assumes a quaternion with W=0 and V=theta*v (where |v| = 1). Exp(q) = (sin(theta)*v, cos(theta))

Parameters

q (Quat) –

Returns

Return type

Quat

classmethod quat_get_angle(q)float

Get the angle of this quaternion

Parameters

q (Quat) –

Returns

Return type

float

classmethod quat_get_axis_x(q)Vector

Get the forward direction (X axis) after it has been rotated by this Quaternion.

Parameters

q (Quat) –

Returns

Return type

Vector

classmethod quat_get_axis_y(q)Vector

Get the right direction (Y axis) after it has been rotated by this Quaternion.

Parameters

q (Quat) –

Returns

Return type

Vector

classmethod quat_get_axis_z(q)Vector

Get the up direction (Z axis) after it has been rotated by this Quaternion.

Parameters

q (Quat) –

Returns

Return type

Vector

classmethod quat_get_rotation_axis(q)Vector

Get the axis of rotation of the Quaternion. This is the axis around which rotation occurs to transform the canonical coordinate system to the target orientation. For the identity Quaternion which has no such rotation, FVector(1,0,0) is returned.

Parameters

q (Quat) –

Returns

Return type

Vector

classmethod quat_inversed(q)Quat

Return an inversed copy of this quaternion.

Parameters

q (Quat) –

Returns

Return type

Quat

classmethod quat_is_finite(q)bool

Determine if all the values are finite (not NaN nor Inf) in this Quat.

Parameters

q (Quat) –

Returns

Return type

bool

classmethod quat_is_identity(q, tolerance=0.0001)bool

Checks whether this Quaternion is an Identity Quaternion. Assumes Quaternion tested is normalized.

Parameters
  • q (Quat) –

  • tolerance (float) – Error tolerance for comparison with Identity Quaternion.

Returns

true if Quaternion is a normalized Identity Quaternion.

Return type

bool

classmethod quat_is_non_finite(q)bool

Determine if there are any non-finite values (NaN or Inf) in this Quat.

Parameters

q (Quat) –

Returns

Return type

bool

classmethod quat_is_normalized(q)bool

Return true if this quaternion is normalized

Parameters

q (Quat) –

Returns

Return type

bool

classmethod quat_log(q)Quat

Quaternion with W=0 and V=theta*v. Used in combination with Exp().

Parameters

q (Quat) –

Returns

Return type

Quat

classmethod quat_make_from_euler(euler)Quat

Convert a vector of floating-point Euler angles (in degrees) into a Quaternion.

Parameters

euler (Vector) – the Euler angles

Returns

constructed Quat

Return type

Quat

classmethod quat_normalize(q, tolerance=0.0001)Quat

Normalize this quaternion if it is large enough as compared to the supplied tolerance. If it is too small then set it to the identity quaternion.

Parameters
  • q (Quat) –

  • tolerance (float) – Minimum squared length of quaternion for normalization.

Returns

q (Quat):

Return type

Quat

classmethod quat_normalized(q, tolerance=0.0001)Quat

Get a normalized copy of this quaternion. If it is too small, returns an identity quaternion.

Parameters
  • q (Quat) –

  • tolerance (float) – Minimum squared length of quaternion for normalization.

Returns

Return type

Quat

classmethod quat_rotate_vector(q, v)Vector

Rotate a vector by this quaternion.

Parameters
  • q (Quat) –

  • v (Vector) – the vector to be rotated

Returns

vector after rotation

Return type

Vector

classmethod quat_rotator(q)Rotator

Convert to Rotator representation of this Quaternion.

Parameters

q (Quat) –

Returns

Return type

Rotator

classmethod quat_set_components(q, x, y, z, w)Quat

Set X, Y, Z, W components of Quaternion.

Parameters
Returns

q (Quat):

Return type

Quat

classmethod quat_set_from_euler(q, euler)Quat

Convert a vector of floating-point Euler angles (in degrees) into a Quaternion.

Parameters
  • q (Quat) – Quaternion to update

  • euler (Vector) – the Euler angles

Returns

q (Quat): Quaternion to update

Return type

Quat

classmethod quat_size(q)float

Get the length of the quaternion.

Parameters

q (Quat) –

Returns

The length of the quaternion.

Return type

float

classmethod quat_size_squared(q)float

Get the squared length of the quaternion.

Parameters

q (Quat) –

Returns

The squared length of the quaternion.

Return type

float

classmethod quat_unrotate_vector(q, v)Vector

Rotate a vector by the inverse of this quaternion.

Parameters
  • q (Quat) –

  • v (Vector) – the vector to be rotated

Returns

vector after rotation by the inverse of this quaternion.

Return type

Vector

classmethod quat_vector_forward(q)Vector

Get the forward direction (X axis) after it has been rotated by this Quaternion.

Parameters

q (Quat) –

Returns

Return type

Vector

classmethod quat_vector_right(q)Vector

Get the right direction (Y axis) after it has been rotated by this Quaternion.

Parameters

q (Quat) –

Returns

Return type

Vector

classmethod quat_vector_up(q)Vector

Get the up direction (Z axis) after it has been rotated by this Quaternion.

Parameters

q (Quat) –

Returns

Return type

Vector

classmethod r_interp_to(current, target, delta_time, interp_speed)Rotator

Tries to reach Target rotation based on Current rotation, giving a nice smooth feeling when rotating to Target rotation.

Parameters
  • current (Rotator) – Actual rotation

  • target (Rotator) – Target rotation

  • delta_time (float) – Time since last tick

  • interp_speed (float) – Interpolation speed, if the speed given is 0, then jump to the target.

Returns

New interpolated position

Return type

Rotator

classmethod r_interp_to_constant(current, target, delta_time, interp_speed)Rotator

Tries to reach Target rotation at a constant rate.

Parameters
  • current (Rotator) – Actual rotation

  • target (Rotator) – Target rotation

  • delta_time (float) – Time since last tick

  • interp_speed (float) – Interpolation speed

Returns

New interpolated position

Return type

Rotator

classmethod r_lerp(a, b, alpha, shortest_path)Rotator

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

Parameters
Returns

Return type

Rotator

classmethod radians_to_degrees(a)float

Returns degrees value based on the input radians

Parameters

a (float) –

Returns

Return type

float

classmethod rand(max)

deprecated: ‘rand’ was renamed to ‘random_integer’.

classmethod rand_bool()

deprecated: ‘rand_bool’ was renamed to ‘random_bool’.

classmethod rand_bool_from_stream(stream)

deprecated: ‘rand_bool_from_stream’ was renamed to ‘random_bool_from_stream’.

classmethod rand_from_stream(max, stream)

deprecated: ‘rand_from_stream’ was renamed to ‘random_integer_from_stream’.

classmethod rand_range(min, max)

deprecated: ‘rand_range’ was renamed to ‘random_integer_in_range’.

classmethod rand_range_from_stream(min, max, stream)

deprecated: ‘rand_range_from_stream’ was renamed to ‘random_integer_in_range_from_stream’.

classmethod random_bool()bool

Returns a uniformly distributed random bool

Returns

Return type

bool

classmethod random_bool_from_stream(stream)bool

Returns a random bool

Parameters

stream (RandomStream) –

Returns

Return type

bool

classmethod random_bool_with_weight(weight)bool
Get a random chance with the specified weight. Range of weight is 0.0 - 1.0 E.g.,

Weight = .6 return value = True 60% of the time

Parameters

weight (float) –

Returns

Return type

bool

classmethod random_bool_with_weight_from_stream(weight, random_stream)bool
Get a random chance with the specified weight. Range of weight is 0.0 - 1.0 E.g.,

Weight = .6 return value = True 60% of the time

Parameters
Returns

Return type

bool

classmethod random_float()float

Returns a random float between 0 and 1

Returns

Return type

float

classmethod random_float_from_stream(stream)float

Returns a random float between 0 and 1

Parameters

stream (RandomStream) –

Returns

Return type

float

classmethod random_float_in_range(min, max)float

Generate a random number between Min and Max

Parameters
Returns

Return type

float

classmethod random_float_in_range_from_stream(min, max, stream)float

Generate a random number between Min and Max

Parameters
Returns

Return type

float

classmethod random_integer(max)int32

Returns a uniformly distributed random number between 0 and Max - 1

Parameters

max (int32) –

Returns

Return type

int32

classmethod random_integer64(max)int64

Returns a uniformly distributed random number between 0 and Max - 1

Parameters

max (int64) –

Returns

Return type

int64

classmethod random_integer64_in_range(min, max)int64

Return a random integer64 between Min and Max (>= Min and <= Max)

Parameters
  • min (int64) –

  • max (int64) –

Returns

Return type

int64

classmethod random_integer_from_stream(max, stream)int32

Returns a uniformly distributed random number between 0 and Max - 1

Parameters
Returns

Return type

int32

classmethod random_integer_in_range(min, max)int32

Return a random integer between Min and Max (>= Min and <= Max)

Parameters
  • min (int32) –

  • max (int32) –

Returns

Return type

int32

classmethod random_integer_in_range_from_stream(min, max, stream)int32

Return a random integer between Min and Max (>= Min and <= Max)

Parameters
Returns

Return type

int32

classmethod random_point_in_bounding_box(origin, 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
Returns

Return type

Vector

classmethod random_rotator(roll=False)Rotator

Generates a random rotation, with optional random roll.

Parameters

roll (bool) –

Returns

Return type

Rotator

classmethod random_rotator_from_stream(roll, stream)Rotator

Create a random rotation

Parameters
Returns

Return type

Rotator

classmethod random_unit_vector()Vector

Returns a random vector with length of 1

Returns

Return type

Vector

classmethod random_unit_vector_from_stream(stream)Vector

Returns a random vector with length of 1.0

Parameters

stream (RandomStream) –

Returns

Return type

Vector

classmethod random_unit_vector_in_cone(cone_dir, cone_half_angle_in_radians)

deprecated: ‘random_unit_vector_in_cone’ was renamed to ‘random_unit_vector_in_cone_in_radians’.

classmethod random_unit_vector_in_cone_in_degrees(cone_dir, cone_half_angle_in_degrees)Vector

Returns a random vector with length of 1, within the specified cone, with uniform random distribution.

Parameters
  • cone_dir (Vector) – The base “center” direction of the cone.

  • cone_half_angle_in_degrees (float) – The half-angle of the cone (from ConeDir to edge), in degrees.

Returns

Return type

Vector

classmethod random_unit_vector_in_cone_in_degrees_from_stream(cone_dir, cone_half_angle_in_degrees, stream)Vector

Returns a random vector with length of 1, within the specified cone, with uniform random distribution.

Parameters
  • cone_dir (Vector) – The base “center” direction of the cone.

  • cone_half_angle_in_degrees (float) – The half-angle of the cone (from ConeDir to edge), in degrees.

  • stream (RandomStream) – The random stream from which to obtain the vector.

Returns

Return type

Vector

classmethod random_unit_vector_in_cone_in_radians(cone_dir, cone_half_angle_in_radians)Vector

Returns a random vector with length of 1, within the specified cone, with uniform random distribution.

Parameters
  • cone_dir (Vector) – The base “center” direction of the cone.

  • cone_half_angle_in_radians (float) – The half-angle of the cone (from ConeDir to edge), in radians.

Returns

Return type

Vector

classmethod random_unit_vector_in_cone_in_radians_from_stream(cone_dir, cone_half_angle_in_radians, stream)Vector

Returns a random vector with length of 1, within the specified cone, with uniform random distribution.

Parameters
  • cone_dir (Vector) – The base “center” direction of the cone.

  • cone_half_angle_in_radians (float) – The half-angle of the cone (from ConeDir to edge), in radians.

  • stream (RandomStream) – The random stream from which to obtain the vector.

Returns

Return type

Vector

classmethod random_unit_vector_in_cone_with_yaw_and_pitch(cone_dir, max_yaw_in_degrees, max_pitch_in_degrees)

deprecated: ‘random_unit_vector_in_cone_with_yaw_and_pitch’ was renamed to ‘random_unit_vector_in_elliptical_cone_in_degrees’.

classmethod random_unit_vector_in_elliptical_cone_in_degrees(cone_dir, max_yaw_in_degrees, max_pitch_in_degrees)Vector

Returns a random vector with length of 1, within the specified cone, with uniform random distribution. The shape of the cone can be modified according to the yaw and pitch angles.

Parameters
  • cone_dir (Vector) –

  • max_yaw_in_degrees (float) – The yaw angle of the cone (from ConeDir to horizontal edge), in degrees.

  • max_pitch_in_degrees (float) – The pitch angle of the cone (from ConeDir to vertical edge), in degrees.

Returns

Return type

Vector

classmethod random_unit_vector_in_elliptical_cone_in_degrees_from_stream(cone_dir, max_yaw_in_degrees, max_pitch_in_degrees, stream)Vector

Returns a random vector with length of 1, within the specified cone, with uniform random distribution. The shape of the cone can be modified according to the yaw and pitch angles.

Parameters
  • cone_dir (Vector) –

  • max_yaw_in_degrees (float) – The yaw angle of the cone (from ConeDir to horizontal edge), in degrees.

  • max_pitch_in_degrees (float) – The pitch angle of the cone (from ConeDir to vertical edge), in degrees.

  • stream (RandomStream) – The random stream from which to obtain the vector.

Returns

Return type

Vector

classmethod random_unit_vector_in_elliptical_cone_in_radians(cone_dir, max_yaw_in_radians, max_pitch_in_radians)Vector

Returns a random vector with length of 1, within the specified cone, with uniform random distribution. The shape of the cone can be modified according to the yaw and pitch angles.

Parameters
  • cone_dir (Vector) –

  • max_yaw_in_radians (float) – The yaw angle of the cone (from ConeDir to horizontal edge), in radians.

  • max_pitch_in_radians (float) – The pitch angle of the cone (from ConeDir to vertical edge), in radians.

Returns

Return type

Vector

classmethod random_unit_vector_in_elliptical_cone_in_radians_from_stream(cone_dir, max_yaw_in_radians, max_pitch_in_radians, stream)Vector

Returns a random vector with length of 1, within the specified cone, with uniform random distribution. The shape of the cone can be modified according to the yaw and pitch angles.

Parameters
  • cone_dir (Vector) –

  • max_yaw_in_radians (float) – The yaw angle of the cone (from ConeDir to horizontal edge), in radians.

  • max_pitch_in_radians (float) – The pitch angle of the cone (from ConeDir to vertical edge), in radians.

  • stream (RandomStream) – The random stream from which to obtain the vector.

Returns

Return type

Vector

classmethod reset_float_spring_state(spring_state)FloatSpringState

Resets the state of a given spring

Parameters

spring_state (FloatSpringState) –

Returns

spring_state (FloatSpringState):

Return type

FloatSpringState

classmethod reset_random_stream(stream)None

Reset a random stream

Parameters

stream (RandomStream) –

classmethod reset_vector_spring_state(spring_state)VectorSpringState

Resets the state of a given spring

Parameters

spring_state (VectorSpringState) –

Returns

spring_state (VectorSpringState):

Return type

VectorSpringState

classmethod rgb_linear_to_hsv(rgb)LinearColor

Converts a RGB linear color to HSV (where H is in R, S is in G, and V is in B)

Parameters

rgb (LinearColor) –

Returns

Return type

LinearColor

classmethod rgb_to_hsv(color) -> (h=float, s=float, v=float, a=float)

Breaks apart a color into individual HSV components (as well as alpha) (Hue is [0..360) while Saturation and Value are 0..1)

Parameters

color (LinearColor) –

Returns

h (float):

s (float):

v (float):

a (float):

Return type

tuple

classmethod rgb_to_hsv_vector(rgb)LinearColor

Converts a RGB linear color to HSV (where H is in R (0..360), S is in G (0..1), and V is in B (0..1))

Parameters

rgb (LinearColor) –

Returns

hsv (LinearColor):

Return type

LinearColor

classmethod rot_rand(roll=False)

deprecated: ‘rot_rand’ was renamed to ‘random_rotator’.

classmethod rot_rand_from_stream(roll, stream)

deprecated: ‘rot_rand_from_stream’ was renamed to ‘random_rotator_from_stream’.

classmethod rotate_angle_axis(vect, angle_deg, axis)Vector

Returns result of vector A rotated by AngleDeg around Axis

Parameters
Returns

Return type

Vector

classmethod rotator_from_axis_and_angle(axis, angle)Rotator

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

Parameters
Returns

Return type

Rotator

classmethod round(a)int32

Rounds A to the nearest integer (e.g., -1.6 becomes -2 and 1.6 becomes 2)

Parameters

a (float) –

Returns

Return type

int32

classmethod round64(a)int64

Rounds A to the nearest integer (e.g., -1.6 becomes -2 and 1.6 becomes 2)

Parameters

a (float) –

Returns

Return type

int64

classmethod safe_divide(a, b)float

This functions returns 0 if B (the denominator) is zero

Parameters
Returns

Return type

float

classmethod seed_random_stream(stream)RandomStream

Create a new random seed for a random stream

Parameters

stream (RandomStream) –

Returns

stream (RandomStream):

Return type

RandomStream

classmethod select_class(a, b, select_a)

If bPickA is true, A is returned, otherwise B is

Parameters
Returns

Return type

type(Class)

classmethod select_color(a, b, pick_a)LinearColor

If bPickA is true, A is returned, otherwise B is

Parameters
Returns

Return type

LinearColor

classmethod select_float(a, b, pick_a)float

If bPickA is true, A is returned, otherwise B is

Parameters
Returns

Return type

float

classmethod select_int(a, b, pick_a)int32

If bPickA is true, A is returned, otherwise B is

Parameters
  • a (int32) –

  • b (int32) –

  • pick_a (bool) –

Returns

Return type

int32

classmethod select_object(a, b, select_a)Object

If bPickA is true, A is returned, otherwise B is

Parameters
Returns

Return type

Object

classmethod select_rotator(a, b, pick_a)Rotator

If bPickA is true, A is returned, otherwise B is

Parameters
Returns

Return type

Rotator

classmethod select_string(a, b, pick_a)str

If bPickA is true, A is returned, otherwise B is

Parameters
Returns

Return type

str

classmethod select_transform(a, b, pick_a)Transform

If bPickA is true, A is returned, otherwise B is

Parameters
Returns

Return type

Transform

classmethod select_vector(a, b, pick_a)Vector

If bPickA is true, A is returned, otherwise B is

Parameters
Returns

Return type

Vector

classmethod set2d(a, x, y)Vector2D

Set the values of the vector directly.

Parameters
Returns

a (Vector2D):

Return type

Vector2D

classmethod set_random_stream_seed(stream, new_seed)RandomStream

Set the seed of a random stream to a specific number

Parameters
Returns

stream (RandomStream):

Return type

RandomStream

classmethod sign_of_float(a)float

Sign (float, returns -1 if A < 0, 0 if A is zero, and +1 if A > 0)

Parameters

a (float) –

Returns

Return type

float

classmethod sign_of_integer(a)int32

Sign (integer, returns -1 if A < 0, 0 if A is zero, and +1 if A > 0)

Parameters

a (int32) –

Returns

Return type

int32

classmethod sign_of_integer64(a)int64

Sign (integer64, returns -1 if A < 0, 0 if A is zero, and +1 if A > 0)

Parameters

a (int64) –

Returns

Return type

int64

classmethod sin(a)float

Returns the sine of A (expects Radians)

Parameters

a (float) –

Returns

Return type

float

classmethod spherical2d_to_unit_cartesian(a)Vector

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

Parameters

a (Vector2D) –

Returns

Return type

Vector

classmethod sqrt(a)float

Returns square root of A

Parameters

a (float) –

Returns

Return type

float

classmethod square(a)float

Returns square of A (A*A)

Parameters

a (float) –

Returns

Return type

float

classmethod subtract_byte_byte(a, b=1)uint8

Subtraction (A - B)

Parameters
  • a (uint8) –

  • b (uint8) –

Returns

Return type

uint8

classmethod subtract_date_time_date_time(a, b)Timespan

Subtraction (A - B)

Parameters
Returns

Return type

Timespan

classmethod subtract_date_time_timespan(a, b)DateTime

Subtraction (A - B)

Parameters
Returns

Return type

DateTime

classmethod subtract_float_float(a, b=1.0)float

Subtraction (A - B)

Parameters
Returns

Return type

float

classmethod subtract_int64_int64(a, b=1)int64

Subtraction (A - B)

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

int64

classmethod subtract_int_int(a, b=1)int32

Subtraction (A - B)

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

int32

classmethod subtract_int_point_int(a, b)IntPoint

Subtraction (A - B)

Parameters
Returns

Return type

IntPoint

classmethod subtract_int_point_int_point(a, b)IntPoint

Returns IntPoint A subtracted by B

Parameters
Returns

Return type

IntPoint

classmethod subtract_linear_color_linear_color(a, b)LinearColor

Element-wise subtraction of two linear colors (R-R, G-G, B-B, A-A)

Parameters
Returns

Return type

LinearColor

classmethod subtract_quat_quat(a, b)Quat

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

Parameters
Returns

Return type

Quat

classmethod subtract_timespan_timespan(a, b)Timespan

Subtraction (A - B)

Parameters
Returns

Return type

Timespan

classmethod subtract_vector2d_float(a, b)Vector2D

Returns Vector A subtracted by B

Parameters
Returns

Return type

Vector2D

classmethod subtract_vector2d_vector2d(a, b)Vector2D

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

Parameters
Returns

Return type

Vector2D

classmethod subtract_vector4_vector4(a, b)Vector4

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

Parameters
Returns

Return type

Vector4

classmethod subtract_vector_float(a, b)Vector

Subtracts a float from each component of a vector

Parameters
Returns

Return type

Vector

classmethod subtract_vector_int(a, b)Vector

Subtracts an integer from each component of a vector

Parameters
  • a (Vector) –

  • b (int32) –

Returns

Return type

Vector

classmethod subtract_vector_vector(a, b)Vector

Vector subtraction

Parameters
Returns

Return type

Vector

classmethod t_interp_to(current, target, delta_time, interp_speed)Transform

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

Parameters
  • current (Transform) – Actual transform

  • target (Transform) – Target transform

  • delta_time (float) – Time since last tick

  • interp_speed (float) – Interpolation speed, if the speed given is 0, then jump to the target.

Returns

New interpolated transform

Return type

Transform

classmethod t_lerp(a, b, alpha, interp_mode=LerpInterpolationMode.QUAT_INTERP)Transform

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

Parameters
Returns

Return type

Transform

classmethod tan(a)float

Returns the tan of A (expects Radians)

Parameters

a (float) –

Returns

Return type

float

classmethod timespan_from_string(timespan_string)Timespan or None

Converts a time span string to a Timespan object

Parameters

timespan_string (str) –

Returns

result (Timespan):

Return type

Timespan or None

classmethod timespan_ratio(a, b)float

Returns the ratio between two time spans (A / B), handles zero values

Parameters
Returns

Return type

float

classmethod to_direction_and_length2d(a) -> (out_dir=Vector2D, out_length=float)

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

Parameters

a (Vector2D) –

Returns

out_dir (Vector2D): Reference passed in to store unit direction vector.

out_length (float): Reference passed in to store length of the vector.

Return type

tuple

classmethod to_rounded2d(a)Vector2D

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

Parameters

a (Vector2D) –

Returns

New FVector2D from this vector that is rounded.

Return type

Vector2D

classmethod to_sign2d(a)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.

Parameters

a (Vector2D) –

Returns

A copy of the vector with each component set to +1 or -1

Return type

Vector2D

classmethod today()DateTime

Returns the local date on this computer

Returns

Return type

DateTime

classmethod transform_determinant(transform)float

Calculates the determinant of the transform (converts to FMatrix internally)

Parameters

transform (Transform) –

Returns

Return type

float

classmethod transform_direction(t, direction)Vector

Transform a direction vector by the supplied transform - will not change its length. For example, if T was an object’s transform, this would transform a direction from local space to world space.

Parameters
Returns

Return type

Vector

classmethod transform_location(t, location)Vector

Transform a position by the supplied transform. For example, if T was an object’s transform, this would transform a position from local space to world space.

Parameters
Returns

Return type

Vector

classmethod transform_position(t, location)

deprecated: ‘transform_position’ was renamed to ‘transform_location’.

classmethod transform_rotation(t, rotation)Rotator

Transform a rotator by the supplied transform. For example, if T was an object’s transform, this would transform a rotation from local space to world space.

Parameters
Returns

Return type

Rotator

classmethod transform_vector4(matrix, vec4)Vector4

Transform the input vector4 by a provided matrix4x4 and returns the resulting vector4.

Parameters
Returns

Transformed vector4.

Return type

Vector4

classmethod utc_now()DateTime

Returns the UTC date and time on this computer

Returns

Return type

DateTime

classmethod v_interp_to(current, 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
  • current (Vector) – Actual position

  • 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.

Returns

New interpolated position

Return type

Vector

classmethod v_interp_to_constant(current, target, delta_time, interp_speed)Vector

Tries to reach Target at a constant rate.

Parameters
  • current (Vector) – Actual position

  • target (Vector) – Target position

  • delta_time (float) – Time since last tick

  • interp_speed (float) – Interpolation speed

Returns

New interpolated position

Return type

Vector

classmethod v_lerp(a, 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
Returns

Return type

Vector

classmethod v_rand()

deprecated: ‘v_rand’ was renamed to ‘random_unit_vector’.

classmethod v_rand_from_stream(stream)

deprecated: ‘v_rand_from_stream’ was renamed to ‘random_unit_vector_from_stream’.

classmethod v_size(a)float

Returns the length of the vector

Parameters

a (Vector) –

Returns

Return type

float

classmethod v_size2d(a)float

Returns the length of a 2D Vector.

Parameters

a (Vector2D) –

Returns

Return type

float

classmethod v_size2d_squared(a)float

Returns the squared length of a 2D Vector.

Parameters

a (Vector2D) –

Returns

Return type

float

classmethod v_size_squared(a)float

Returns the squared length of the vector

Parameters

a (Vector) –

Returns

Return type

float

classmethod v_size_xy(a)float

Returns the length of the vector’s XY components.

Parameters

a (Vector) –

Returns

Return type

float

classmethod v_size_xy_squared(a)float

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

Parameters

a (Vector) –

Returns

Return type

float

classmethod vector2d_interp_to(current, 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
  • current (Vector2D) – Actual position

  • 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.

Returns

New interpolated position

Return type

Vector2D

classmethod vector2d_interp_to_constant(current, target, delta_time, interp_speed)Vector2D

Tries to reach Target at a constant rate.

Parameters
  • current (Vector2D) – Actual position

  • target (Vector2D) – Target position

  • delta_time (float) – Time since last tick

  • interp_speed (float) – Interpolation speed

Returns

New interpolated position

Return type

Vector2D

classmethod vector4_assign(a, vector)Vector4

Assign the values of the supplied vector.

Parameters
Returns

a (Vector4):

Return type

Vector4

classmethod vector4_cross_product3(a, b)Vector4

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

Parameters
Returns

Return type

Vector4

classmethod vector4_dot_product(a, b)float

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

Parameters
Returns

Return type

float

classmethod vector4_dot_product3(a, b)float

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

Parameters
Returns

Return type

float

classmethod vector4_is_nan(a)bool

Determines if any component is not a number (NAN)

Parameters

a (Vector4) –

Returns

true if one or more components is NAN, otherwise false.

Return type

bool

classmethod vector4_is_nearly_zero3(a, tolerance=0.0001)bool

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

Parameters
Returns

true if vector is in tolerance to zero, otherwise false.

Return type

bool

classmethod vector4_is_normal3(a)bool

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

Parameters

a (Vector4) –

Returns

true if normalized, false otherwise.

Return type

bool

classmethod vector4_is_unit3(a, squared_lenth_tolerance=0.0001)bool

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

Parameters
Returns

true if unit, false otherwise.

Return type

bool

classmethod vector4_is_zero(a)bool

Checks whether all components of the vector are exactly zero.

Parameters

a (Vector4) –

Returns

true if vector is exactly zero, otherwise false.

Return type

bool

classmethod vector4_mirror_by_vector3(direction, 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
  • direction (Vector4) – Direction vector the ray is coming from.

  • surface_normal (Vector4) – A normal of the surface the ray should be reflected on.

Returns

Reflected vector.

Return type

Vector4

classmethod vector4_negated(a)Vector4

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

Parameters

a (Vector4) –

Returns

Return type

Vector4

classmethod vector4_normal3(a, tolerance=0.0001)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
  • a (Vector4) –

  • tolerance (float) – Minimum squared vector length.

Returns

A normalized copy if safe, (0,0,0) otherwise.

Return type

Vector4

classmethod vector4_normal_unsafe3(a)Vector4

Calculates normalized unit version of vector without checking for zero length. The W element is ignored and the returned vector has W=0.

Parameters

a (Vector4) –

Returns

Normalized version of vector.

Return type

Vector4

classmethod vector4_normalize3(a, tolerance=0.0)Vector4

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
  • a (Vector4) –

  • tolerance (float) – Minimum squared length of vector for normalization.

Returns

a (Vector4):

Return type

Vector4

classmethod vector4_set(a, x, y, z, w)Vector4

Set the values of the vector directly.

Parameters
Returns

a (Vector4):

Return type

Vector4

classmethod vector4_size(a)float

Returns the length of the vector.

Parameters

a (Vector4) –

Returns

Return type

float

classmethod vector4_size3(a)float

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

Parameters

a (Vector4) –

Returns

Return type

float

classmethod vector4_size_squared(a)float

Returns the squared length of the vector.

Parameters

a (Vector4) –

Returns

Return type

float

classmethod vector4_size_squared3(a)float

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

Parameters

a (Vector4) –

Returns

Return type

float

classmethod vector_add_bounded(a, add_vect, radius)Vector

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

Parameters
  • a (Vector) –

  • add_vect (Vector) – Vector to add.

  • radius (float) – Half size of the cube.

Returns

a (Vector):

Return type

Vector

classmethod vector_assign(a, vector)Vector

Assign the values of the supplied vector.

Parameters
  • a (Vector) –

  • vector (Vector) – Vector to copy values from.

Returns

a (Vector):

Return type

Vector

classmethod vector_bounded_to_box(vect, box_min, box_max)Vector

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

Parameters
Returns

Return type

Vector

classmethod vector_bounded_to_cube(vect, radius)Vector

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

Parameters
  • vect (Vector) –

  • radius (float) – Half size of the cube (or radius of sphere circumscribed in the cube).

Returns

A copy of this vector, bound by cube.

Return type

Vector

classmethod vector_clamp_size2d(a, min, max)Vector

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

Parameters
Returns

Return type

Vector

classmethod vector_clamp_size_max(a, max)Vector

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

Parameters
Returns

Return type

Vector

classmethod vector_clamp_size_max2d(a, max)Vector

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

Parameters
Returns

Return type

Vector

classmethod vector_component_max(a, b)Vector

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

Parameters
Returns

Return type

Vector

classmethod vector_component_min(a, b)Vector

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

Parameters
Returns

Return type

Vector

classmethod vector_cosine_angle2d(a, b)float

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

Parameters
  • a (Vector) –

  • b (Vector) – the other vector to find the 2D cosine of the angle with.

Returns

The cosine.

Return type

float

classmethod vector_distance(v1, v2)float

Distance between two points.

Parameters
  • v1 (Vector) – The first point.

  • v2 (Vector) – The second point.

Returns

The distance between two points.

Return type

float

classmethod vector_distance2d(v1, v2)float

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

Parameters
  • v1 (Vector) – The first point.

  • v2 (Vector) – The second point.

Returns

The distance between two points in the XY plane.

Return type

float

classmethod vector_distance2d_squared(v1, v2)float

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

Parameters
  • v1 (Vector) – The first point.

  • v2 (Vector) – The second point.

Returns

The distance between two points in the XY plane.

Return type

float

classmethod vector_distance_squared(v1, v2)float

Squared distance between two points.

Parameters
  • v1 (Vector) – The first point.

  • v2 (Vector) – The second point.

Returns

The squared distance between two points.

Return type

float

classmethod vector_get_abs(a)Vector

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

Parameters

a (Vector) –

Returns

A copy of this vector with absolute value of each component.

Return type

Vector

classmethod vector_get_abs_max(a)float

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

Parameters

a (Vector) –

Returns

Return type

float

classmethod vector_get_abs_min(a)float

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

Parameters

a (Vector) –

Returns

Return type

float

classmethod vector_get_projection(a)Vector

Projects 2D components of vector based on Z.

Parameters

a (Vector) –

Returns

Projected version of vector based on Z.

Return type

Vector

classmethod vector_get_sign_vector(a)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.

Parameters

a (Vector) – copy of the vector with each component set to +1 or -1

Returns

Return type

Vector

classmethod vector_heading_angle(a)float

Convert a direction vector into a ‘heading’ angle.

Parameters

a (Vector) –

Returns

‘Heading’ angle between +/-PI radians. 0 is pointing down +X.

Return type

float

classmethod vector_is_nan(a)bool

Determines if any component is not a number (NAN)

Parameters

a (Vector) –

Returns

true if one or more components is NAN, otherwise false.

Return type

bool

classmethod vector_is_nearly_zero(a, tolerance=0.0001)bool

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

Parameters
  • a (Vector) –

  • tolerance (float) – Error tolerance.

Returns

true if vector is in tolerance to zero, otherwise false.

Return type

bool

classmethod vector_is_normal(a)bool

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

Parameters

a (Vector) –

Returns

true if normalized, false otherwise.

Return type

bool

classmethod vector_is_uniform(a, tolerance=0.0001)bool

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

Parameters
  • a (Vector) –

  • tolerance (float) – Error tolerance.

Returns

true if the vectors are equal within tolerance limits, false otherwise.

Return type

bool

classmethod vector_is_unit(a, squared_lenth_tolerance=0.0001)bool

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

Parameters
Returns

true if unit, false otherwise.

Return type

bool

classmethod vector_is_zero(a)bool

Checks whether all components of the vector are exactly zero.

Parameters

a (Vector) –

Returns

true if vector is exactly zero, otherwise false.

Return type

bool

classmethod vector_mirror_by_plane(a, plane)Vector

Mirrors a vector about a plane.

Parameters
Returns

Mirrored vector.

Return type

Vector

classmethod vector_normal2d(a, tolerance=0.0001)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
  • a (Vector) –

  • tolerance (float) – Minimum squared vector length.

Returns

Normalized copy if safe, (0,0,0) otherwise.

Return type

Vector

classmethod vector_normal_unsafe(a)Vector

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

Parameters

a (Vector) –

Returns

Normalized version of vector.

Return type

Vector

classmethod vector_normalize(a, tolerance=0.0)Vector

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

Parameters
  • a (Vector) –

  • tolerance (float) – Minimum squared length of vector for normalization.

Returns

a (Vector):

Return type

Vector

classmethod vector_project_on_to_normal(v, normal)Vector

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

Parameters
  • v (Vector) –

  • normal (Vector) – Vector to project onto (assumed to be unit length).

Returns

Projected vector.

Return type

Vector

classmethod vector_reciprocal(a)Vector

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

Parameters

a (Vector) –

Returns

Reciprocal of this vector.

Return type

Vector

classmethod vector_set(a, x, y, z)Vector

Set the values of the vector directly.

Parameters
Returns

a (Vector):

Return type

Vector

classmethod vector_snapped_to_grid(vect, grid_size)Vector

Gets a copy of this vector snapped to a grid.

Parameters
  • vect (Vector) –

  • grid_size (float) – Grid dimension / step.

Returns

A copy of this vector snapped to a grid.

Return type

Vector

classmethod vector_spring_interp(current, 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
  • current (Vector) – Current value

  • 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

Returns

spring_state (VectorSpringState): Data related to spring model (velocity, error, etc..) - Create a unique variable per spring

Return type

VectorSpringState

classmethod vector_to_degrees(a)Vector

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

Parameters

a (Vector) –

Returns

Vector containing degree values

Return type

Vector

classmethod vector_to_radians(a)Vector

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

Parameters

a (Vector) –

Returns

Vector containing radian values

Return type

Vector

classmethod vector_unit_cartesian_to_spherical(a)Vector2D

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

Parameters

a (Vector) –

Returns

Output Theta will be in the range [0, PI], and output Phi will be in the range [-PI, PI].

Return type

Vector2D

classmethod vector_unwind_euler(a)Vector

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

Parameters

a (Vector) –

Returns

a (Vector):

Return type

Vector

classmethod weighted_moving_average_f_rotator(current_sample, previous_sample, weight)Rotator

Calculates the new value in a weighted moving average series using the previous value and the weight

Parameters
  • current_sample (Rotator) – The value to blend with the previous sample to get a new weighted value

  • previous_sample (Rotator) – The last value from the series

  • weight (float) – The weight to blend with

Returns

the next value in the series

Return type

Rotator

classmethod weighted_moving_average_f_vector(current_sample, previous_sample, weight)Vector

Calculates the new value in a weighted moving average series using the previous value and the weight

Parameters
  • current_sample (Vector) – The value to blend with the previous sample to get a new weighted value

  • previous_sample (Vector) – The last value from the series

  • weight (float) – The weight to blend with

Returns

the next value in the series

Return type

Vector

classmethod weighted_moving_average_float(current_sample, previous_sample, weight)float

Calculates the new value in a weighted moving average series using the previous value and the weight

Parameters
  • current_sample (float) – The value to blend with the previous sample to get a new weighted value

  • previous_sample (float) – The last value from the series

  • weight (float) – The weight to blend with

Returns

the next value in the series

Return type

float

classmethod wrap(value, min, max)int32

Returns Value between A and B (inclusive) that wraps around

Parameters
  • value (int32) –

  • min (int32) –

  • max (int32) –

Returns

Return type

int32

classmethod xor_int64_int64(a, b)int64

Bitwise XOR (A ^ B)

Parameters
  • a (int64) –

  • b (int64) –

Returns

Return type

int64

classmethod xor_int_int(a, b)int32

Bitwise XOR (A ^ B)

Parameters
  • a (int32) –

  • b (int32) –

Returns

Return type

int32