Attention
You are viewing PyUnity docs under the develop
branch.
As such, they are only applicable if you installed from source.
Go to https://docs.pyunity.x10.bz/en/latest/ for the most recent
release.
pyunity.values.vector module¶
Source code: pyunity/values/vector.py
- pyunity.values.vector.conv(num)[source]¶
Convert float to string and removing decimal place as necessary.
- class pyunity.values.vector.Vector[source]¶
Bases:
LockedLiteral
- property intTuple¶
Return the x, y and z values of this vector as ints
- class pyunity.values.vector.Vector2[source]¶
Bases:
Vector
- getLengthSqrd()[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:
- property length¶
Gets the magnitude of the vector
- normalized()[source]¶
Get a normalized copy of the vector, or Vector2(0, 0) if the length is 0.
- Returns:
A normalized vector
- Return type:
- getDistance(other)[source]¶
The distance between this vector and the other vector
- Returns:
The distance
- Return type:
- getDistSqrd(other)[source]¶
The distance between this vector and the other vector, squared. It is more efficient to call this than to call
Vector2.getDistance()
and square it.- Returns:
The squared distance
- Return type:
- clamp(min, max)[source]¶
Returns a clamped vector between two other vectors, resulting in the vector being as close to the edge of a bounding box created as possible.
- class pyunity.values.vector.Vector3[source]¶
Bases:
Vector
- getLengthSqrd()[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:
- property length¶
Gets the magnitude of the vector
- normalized()[source]¶
Get a normalized copy of the vector, or Vector3(0, 0, 0) if the length is 0.
- Returns:
A normalized vector
- Return type:
- getDistance(other)[source]¶
The distance between this vector and the other vector
- Returns:
The distance
- Return type:
- getDistSqrd(other)[source]¶
The distance between this vector and the other vector, squared. It is more efficient to call this than to call
Vector3.getDistance()
and square it.- Returns:
The squared distance
- Return type:
- clamp(min, max)[source]¶
Returns a clamped vector between two other vectors, resulting in the vector being as close to the edge of a bounding box created as possible.