Vector3 class
Represents 3D points and vectors.
Use this class to pass positions and directions to item transforms and perform vector operations.
Note: By default, DX engine uses Z
as "up".
Constructors
constructor | (self, x: float, y: float, z: float) |
Methods
__add__ | (self, other: Vector3) -> Vector3 |
Adds this vector and |
|
angle | (self, other: Vector3) -> float |
Returns the angle in radians from this vector to |
|
cross | (self, other: Vector3) -> Vector3 |
Calculates the cross product of this vector and |
|
dist | (self, other: Vector3) -> float |
Returns the distance between this vector and |
|
static | distance2 | (a: Vector3, b: Vector3) -> float |
Returns the squared distance between vector |
__truediv__ | (self, d: float) -> Vector3 |
Divides all components of this vector by divisor |
|
dot | (self, other: Vector3) -> float |
Calculates the dot product of this vector and |
|
__eq__ | (self, v: Vector3) -> bool |
Returns |
|
limit_length | (self, l: float) -> Vector3 |
Returns a copy of this vector with limited length |
|
max | (self, other: Vector3) -> Vector3 |
Returns a new vector made from the largest components of this vector and |
|
min | (self, other: Vector3) -> Vector3 |
Returns a new vector made from the smallest components of this vector and |
|
__mul__ | (self, m: float) -> Vector3 |
Multiplies each component of this by a number |
|
project | (self, other: Vector3) -> Vector3 |
Projects this vector onto |
|
project_on_plane | (self, normal: Vector3) -> Vector3 |
Projects this vector onto a plane defined by a |
|
__sub__ | (self, other: Vector3) -> Vector3 |
Subtracts each component of |
|
to_array | (self) -> list[float] |
Properties
readonly | length | float |
Returns the length of this vector. |
readonly | normalized | Vector3 |
Returns a copy of this vector with length |
static readonly | one | Vector3 |
Shorthand for writing |
readonly | sqr_length | float |
Returns the squared length of this vector. |
readonly | x | float |
|
readonly | y | float |
|
readonly | z | float |
|
static readonly | zero | Vector3 |
Shorthand for writing |