Get Xna Right Pointing Angled Point - CSharp Microsoft.Xna.Framework

CSharp examples for Microsoft.Xna.Framework:Xna

Description

Get Xna Right Pointing Angled Point

Demo Code


using Microsoft.Xna.Framework;
using System;/*from  ww  w  .  j  a va 2  s  .  c  o m*/

public class Main{
        public static Vector2 GetRightPointingAngledPoint(int degrees) {
            double angle = System.Math.PI*degrees/180.0;
            double sinAngle = System.Math.Sin(angle);
            double cosAngle = System.Math.Cos(angle);

            float xAngle = (float) sinAngle;
            float yAngle = (float) cosAngle;

            return new Vector2(xAngle, yAngle);
        }
}

Related Tutorials