Converting vector to angleArchives Forums/BlitzPlus Programming/Converting vector to angle
| I have a little spaceship that flies around, and I want its sprite to rotate to face its direction of movement. I know the answer lies in the Atan2() function, but that's about it. I've tried writing the code to do it, but it didn't work at all (it just made my ship graphic into a blurry little circle).|
The ships velocity is stored in an xvel variable and a yvel variable. I need to convert this vector into an angle which I can feed into RotateImage().
| Atan2(yvel, xvel) should work perfectly, but you can't hope to use RotateImage() in realtime... |
| I've always found that it works just fine in realtime. Hmm. I guess I just have a fast computer. |