revival/game/Assets/Scripts/Util/MathsExtensions.cs

22 lines
506 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Extensions
{
public static class MathsExtensions
{
public static Vector2 Rotate( this Vector2 v, float angle )
{
float sa = Mathf.Sin( angle );
float ca = Mathf.Cos( angle );
return new Vector2
{
x = ca * v.x - sa * v.y,
y = sa * v.x + ca * v.y
};
}
}
}