Help - Search - Members - Calendar
Full Version: Coordinate System Troubles...
BleepingComputer.com > Software > Programming
   
Ryan 3000
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
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.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.