Calculating an Angle from a Vector

rated by 0 users
This post has 0 Replies | 0 Followers

Top 10 Contributor
Posts 768
The Dragon Rider Posted: Sat, Apr 26 2008 1:04 PM

Many users may find this function useful:

http://phrogram.com/forums/permalink/6559/6579/ShowThread.aspx#6579

I use this function to point a Polygon at a Point ( in this case, the mouse ):

 Var RotationVector as Vector

 RotationVector.X = Polygon.GetCenter().X - Mouse.X
 RotationVector.Y =  Polygon.GetCenter().Y - Mouse.Y
 Polygon.Rotation = AngleFromVector( RotationVector.X, RotationVector.Y ) 

 

You may need to add or subtract a few degrees, depending on the polygon's shape. Tell me if you find any bugs.

Happy Phrogramming! 

Page 1 of 1 (1 items) | RSS