Math
Remap(value, oldMin, oldMax, min, max)
Transform a [oldMin < value < oldMax] to a [min < value < max], scaled with ratio
AngleToDirection
Angle (degres) to direction 2D
Vector2 normalizedDirection = Math.AngleToDirection(transform.rotation.eulerAngles.z);
DirectionToAngle
Direction 2D to Angle (degres)
float angle = Math.DirectionToAngle((target.transform.position - transform.position).normalized);
Intersects
// Vectors intersection; returns {x, y} or null
float[] Intersects(Vector2 pA1, Vector2 pA2, Vector2 pB1, Vector3 pB2)
// Tests if a rect collides with a cicle
bool Intersects(Rect rect, Vector2 circlePosition, float circleSize)
DistancePointLine
float DistancePointLine(Vector3 point, Vector3 lineStart, Vector3 lineEnd);
Vector2Rotate
Vector2 Vector2Rotate(Vector2 lineStart, Vector2 lineEnd, float angle = 0f);