pyunity.vector3 module¶
A class to store x, y and z values, with a lot of utility functions.
-
class
pyunity.vector3.
Vector3
(x, y, z)[source]¶ Bases:
object
-
clamp
(min, max)[source]¶ Clamps a vector between two other vectors, resulting in the vector being as close to the edge of a bounding box created as possible.
-
dot
(other)[source]¶ Dot product of two vectors.
- Parameters
other (Vector3) – Other vector
- Returns
Dot product of the two vectors
- Return type
float
-
get_dist_sqrd
(other)[source]¶ The distance between this vector and the other vector, squared. It is more efficient to call this than to call get_distance and square it.
- Returns
The squared distance
- Return type
float
-
get_distance
(other)[source]¶ The distance between this vector and the other vector
- Returns
The distance
- Return type
float
-
get_length
()[source]¶ Gets the length of the vector. See get_length_sqrd for details on optimizing.
- Returns
The length of the vector squared
- Return type
float
-
get_length_sqrd
()[source]¶ Gets the length of the vector squared. This is much faster than finding the length.
- Returns
The length of the vector squared
- Return type
float
-
property
int_tuple
¶ Return the x, y and z values of this vector as ints
-
property
length
¶ Gets or sets the magnitude of the vector
-
normalize_return_length
()[source]¶ Normalize the vector and return its length before the normalization
- Returns
The length before the normalization
- Return type
float
-
-
pyunity.vector3.
clamp
(x, _min, _max)¶ Clamp a value between a minimum and a maximum