So - I think I’m missing something fundamental. Or maybe not.
I have a player (a space ship) that rotates fixed about the center of the screen. I have a variable, r, that represents its angle of rotation compared to some arbitrary origin. So far, so good.
Now, I want to be able to touch, and turn toward that touch. I’ve done it like this:
t = vec2(CurrentTouch.x-w2, CurrentTouch.y-w2) r = math.deg(origin:angleBetween(t))-90
Origin is a vector that defines that arbitrary origin I mentioned. The 90 is a fudge factor because my model was sideways.
This works. But now I want it to not “snap” to the touch, but turn at some maximum angular speed - say 5 degrees per frame. This being a game-level approximation of rotational inertia.
Here’s the issue - I’m starting to have to convert back and forth between angles and vectors and I am concerned about cumulative effects on the angles and it’s just becoming ugly and non-elegant. And non-elegant is often a sign I’m doing something wrong.
There’s a part of me says I should be able to do this all with vectors, elegantly. I know rotate() takes degrees, but I have this gut feeling the rest should be all in vectors. There’s a part of my spine screaming “dot product” at me, but I’ve not been a math major for a loooong time.
So - someone who knows the math better (Andrew, I’m looking at you, but anyone might know better than I - this sort of thing for me has always been very trial-and-error.) to say “nope, it’s complex, that’s just what you do” or “how pitiful, you do this and this -see?”.
I would normally just pummel it into submission, but when I make code for others to see… Well, I should try to set a better example. And I am not proud - I freely admit my ignorance, I seek to learn the right way to do it.