Ryan 3000
May 29 2008, 01:16 PM
I am making a game in XNA that involves missiles pointing in the direction of the object they are chasing. I know how to make it move at the right speed, but I cannot make it face the right direction. How can I convert a ratio of coordinates to a radian number?
For example: If I had a missile at 10, 10 and was aiming at 40, 100; how would I make the missile point at 40, 100?
groovicus
May 29 2008, 05:29 PM
There is probably a C# library that will do that for you, but I wouldn't know which one right off hand. I know that the formula that you want is used in the 2D sample game. Did you work through that tutorial, or are you using tutorials off the web site?
The quick and dirty way to do it would be to just use trigonometry, but I am betting that someone on the XNA forums can probably help much more quickly than I can.