smrendererv3/SMCode/SM.Base/Utility/RotationUtility.cs
Michel Fedde 6f23a80f7f 17.01.2021
+ WPF-Support
+ Game Controller System
+ GameKeybind System

+ SM_WPF_TEST
2021-01-17 21:13:37 +01:00

24 lines
No EOL
525 B
C#

#region usings
using System;
using OpenTK;
#endregion
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(origin.X - target.X, target.Y - origin.Y));
}
}
}