Math and vector utility functions.
Type | Name |
---|---|
Vector3 | func clampedv3(vector: Vector3, limit: float) -> Vector3 |
float | func vector3_to_angle(vector: Vector3) -> float |
float | func vector2_to_angle(vector: Vector2) -> float |
Vector2 | func angle_to_vector2(angle: float) -> Vector2 |
Vector2 | func to_vector2(vector: Vector3) -> Vector2 |
Vector3 | func to_vector3(vector: Vector2) -> Vector3 |
func clampedv3(vector: Vector3, limit: float) -> Vector3
Returns the vector
with its length capped to limit
.
func vector3_to_angle(vector: Vector3) -> float
Returns an angle in radians between the positive X axis and the vector
.
This assumes orientation for 3D agents that are upright and rotate around the Y axis.
func vector2_to_angle(vector: Vector2) -> float
Returns an angle in radians between the positive X axis and the vector
.
func angle_to_vector2(angle: float) -> Vector2
Returns a directional vector from the given orientation angle.
This assumes orientation for 2D agents or 3D agents that are upright and rotate around the Y axis.
func to_vector2(vector: Vector3) -> Vector2
Returns a vector2 with vector
’s x and y components.
func to_vector3(vector: Vector2) -> Vector3
Returns a vector3 with vector
’s x and y components and 0 in z.