public void GetCorner(Vec2[] corner) { if (corner == null) { throw new ArgumentNullException("Corner must not null array"); } int count = corner.Length; count = (int)UMath.Clamp(count, 0, 4); for (int i = 0; i < count; i++) { corner[0] = new Vec2(x, y); corner[1] = new Vec2(x + width, y); corner[2] = new Vec2(x, y + height); corner[3] = new Vec2(x + width, y + height); } }
public static float AngleRad(Vec2 from, Vec3 to) { return(UMath.Acos(UMath.Clamp(Vec2.Dot(from.normalized, to.normalized), -1f, 1f))); }