Get Angled Point for Xna - CSharp Microsoft.Xna.Framework

CSharp examples for Microsoft.Xna.Framework:Xna

Description

Get Angled Point for Xna

Demo Code


using Microsoft.Xna.Framework;
using System;/* w  w  w.  ja  v  a  2 s.c o m*/

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

            double xAngle = sinAngle;
            double yAngle = cosAngle;

            return new Vector2((float) xAngle, (float) yAngle);
        }
}

Related Tutorials