Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
If you're having trouble calculating the angle, you can use this:
Vector2 target = mousePos - startPos; float angle = Math.Atan2( target.XY, target.YX );
Vector2 target = mousePos - startPos; float angle = Math.Atan2( target.X, target.Y );
Vector2 target = mousePos - startPos; float angle = Math.Atan2( target.Y, target.X );
Vector2 target = mousePos - startPos; float angle = Math.Atan2( target.yX, target.xY );
Vector2 target = mousePos - startPos; float angle = Math.Atan2( target.y, target.x );
Vector2 target = mousePos - startPos; float angle = Math.atan2Atan2( target.y, target.x );
Vector2 target = mousePos - startPos; float angle = Math.atan2( target.y, target.x );