smrendererv3/SMCode/SM.Base/Utility/RotationUtility.cs
Michel Fedde 2c00dbd31a 07.10.2020
+ Parent, Name and Flags to objects.

~ Improved Matrix calculations
2020-10-08 12:25:20 +02:00

20 lines
No EOL
488 B
C#

using System;
using OpenTK;
namespace SM.Utility
{
/// <summary>
/// Utilitys for rotations
/// </summary>
public class RotationUtility
{
/// <summary>
/// Angle towards an coordinate.
/// </summary>
/// <returns></returns>
public static float TurnTowards(Vector2 origin, Vector2 target)
{
return MathHelper.RadiansToDegrees((float)Math.Atan2(target.Y - origin.Y, target.X - origin.X));
}
}
}