upvote
Based on my experience writing many games that work great barring the occasional random physics engine explosion, I suspect that trigonometry is responsible for a significant proportion of glitches.

I think over the years I subconsciously learned to avoid trig because of the issues mentioned, but I do still fall back to angles, especially for things like camera rotation. I am curious how far the OP goes with this crusade in their production code.

reply
You can definitely handle camera rotation via vector operations on rotation matrices.
reply
Your response is well-grounded--trig is trouble. Angles are often fine, but many 3rd party library functions are not.

Have you ended up with a set of self-implemented tools that you reuse?

reply
> I think this is missing the reason why these APIs are designed like this: because they're convenient and intuitive

Agreed. In my view, the method the author figured out is far from intuitive for the general population, including me.

reply
I guess the point is: How often do we really need actual angles in the code? Probably only at the very ends: input from users and output to users. Everywhere else, we should just be treating them as sin/cos pairs or dot/cross pairs. So when the user inputs an angle, immediately convert it to what the computer actually needs, store it that way throughout the computation, and then only if/when the user needs to see an actual angle would you need to convert it back.
reply