Jump to content

XNA MathHelper

Posted on:November 28, 2010 at 01:00 AM

Today just a short note. Recently I’ve been working on a XNA project. In my project I needed to rotate line. I used that calculation:

float angle = (float)Math.Atan2(point2.Y - point1.Y, point2.X - point1.X);

to calculate the angle in radians and the use **angle **in SpriteBatch.Draw() method. Recently I found MathHelper class from XNA. I has a lot of useful methods. One of those is:

MathHelper.ToRadians(90);

This is what I was looking for!