Hey, we started trigonometry in math this year. I sat down a few days ago and created a function calculating the angle, in degrees(0-360), from one point to another. I have tested my function thoroughly(in all "4 main directions"), and it seems to work. I started thinking about using this for direction of objects in games and I wondered what is the best way to go about doing this with SDL's coordinate system.
I made a simple drawing to kinda illustrate my question:
It's natural for me to think that 90 degrees is straight up, 0 is straight to the right, 135 is diagonally up to the left, 270 is straight down and so on. Should I translate the angle(in degrees) in my function so that 90 is in fact straight up( on-screen ) or should I keep it as it is, 90 = straight down, higher y value?
Why use angles when you can use vectors? Yes, it could be an option to generate a vector at a certain angle, but other than that, there is little to no advantage (and plenty of disadvantages - mainly that trig is so expensive to calculate) that comes from using angles over vectors. I mean, it's cool and all, but it's not really a good idea in the long run.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Sorry for not replying, my comp. was at repair for like a month (stupid ash-cloud preventing part transport) and now I had exams, so I haven't been around or devved a lot.
Ginto8 wrote:Why use angles when you can use vectors? Yes, it could be an option to generate a vector at a certain angle, but other than that, there is little to no advantage (and plenty of disadvantages - mainly that trig is so expensive to calculate) that comes from using angles over vectors. I mean, it's cool and all, but it's not really a good idea in the long run.
Yeah, I actually have a good system working with vectors now, I saw your reply and changed my mind. This will be featured in my next youtube video, the 4th episode of my Amateur Game Dev series, along with some simple collision/physics... :D