4 ms·
Based on my experience writing many games that work great barring the occasional random physics engine explosion, I suspect that trigonometry is responsible for
by et1337 7mo ago
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.
- xbar 7mo agoYour 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?
- waffletower 7mo agoYou can definitely handle camera rotation via vector operations on rotation matrices.
- 20k 7mo agoYes, for physics engines I think that's a very good use case when its worth the extra complexity for robustness. Generally I think if errors (or especially nan's) can meaningfully compound, ie if you have persistent state, that's when its a good idea to do a deeper investigation