Class VectorUtility
Provides utility functions for vector.
Methods
Quadrant(Vector2 direction)
Get the quadrant of direction direction.
public static QuadrantType Quadrant(Vector2 direction)
VerticalDirection(Vector2 direction, Vector2 leftDirection, Vector2 rightDirection, [bool safe = false])
Gets the two directions perpendicular to the given direction.
public static void VerticalDirection(Vector2 direction, Vector2 leftDirection, Vector2 rightDirection, [bool safe = false])
VerticalDirection(Vector2 direction, Vector2 leftDirection, Vector2 rightDirection, CoordinateType coordinateType, [bool safe = false])
Gets the two directions perpendicular to the given direction.
public static void VerticalDirection(Vector2 direction, Vector2 leftDirection, Vector2 rightDirection, CoordinateType coordinateType, [bool safe = false])
VerticalDirectionLeft(Vector2 direction, [bool safe = false])
Gets the vertical direction to the left of the direction direction.
public static Vector2 VerticalDirectionLeft(Vector2 direction, [bool safe = false])
VerticalDirectionLeft(Vector2 direction, CoordinateType coordinateType, [bool safe = false])
Gets the vertical direction to the left of the direction direction.
public static Vector2 VerticalDirectionLeft(Vector2 direction, CoordinateType coordinateType, [bool safe = false])
VerticalDirectionRight(Vector2 direction, [bool safe = false])
Gets the vertical direction to the right of the direction direction.
public static Vector2 VerticalDirectionRight(Vector2 direction, [bool safe = false])
VerticalDirectionRight(Vector2 direction, CoordinateType coordinateType, [bool safe = false])
Gets the vertical direction to the right of the direction direction.
public static Vector2 VerticalDirectionRight(Vector2 direction, CoordinateType coordinateType, [bool safe = false])
ProjectOnPlane(Vector3 vector3, Vector3 planeNormal)
Get the projection vector of vector vector3 on the plane planeNormal.
public static Vector3 ProjectOnPlane(Vector3 vector3, Vector3 planeNormal)
ProjectOnPlaneDirection(Vector3 direction, Vector3 planeNormal)
Get the projection direction of vector vector3 on the plane planeNormal.
public static Vector3 ProjectOnPlaneDirection(Vector3 direction, Vector3 planeNormal)
Rotate(Vector3 vector3, Vector3 angle)
Rotates a 3D vector by the specified angle (degrees).
public static Vector3 Rotate(Vector3 vector3, Vector3 angle)
Rotate2D(Vector2 vector2, float angle)
Rotates a 2D vector by the specified angle (degrees).
public static Vector2 Rotate2D(Vector2 vector2, float angle)
Cross(Vector2 a, Vector2 b)
Get the result of the cross product of vectors a and b.
public static float Cross(Vector2 a, Vector2 b)
Dot(Vector2 a, Vector2 b)
Get the result of the dot product of vectors a and b.
public static float Dot(Vector2 a, Vector2 b)
AngleToDirection(float angle)
Converts an unsigned angle angle to its corresponding clockwise direction.
public static Vector2 AngleToDirection(float angle)
DirectionToAngle(Vector2 direction, [AngleRangeType angleRangeType = SignedHalfRange])
Get the angle corresponding to the direction direction (the starting axis of this angle is the vector (0, 1).
public static float DirectionToAngle(Vector2 direction, [AngleRangeType angleRangeType = SignedHalfRange])
Angle(Vector2 start, Vector2 end, [AngleRangeType angleRangeType = SignedHalfRange])
Computes the angle between vectors start and end,
measured from start as the baseline direction.
public static float Angle(Vector2 start, Vector2 end, [AngleRangeType angleRangeType = SignedHalfRange])