I find it interesting how some kinds of math work pretty much the same regardless of the number of dimensions. For instance vector and matrix code hardly changes when you move between two, three, or higher dimensions. You just alter the number of components in each vector, then proceed to apply the same computations the same way as before.
Newtonian physics tends to be implemented using vectors and matrices, which explains why it is so easy to apply the same "realistic" style physics to both 2D and 3D games.
Thought for the day: physicists suspect that what we perceive as 3D reality might in fact have many more dimensions. So what if we are all actually NPCs in a retro arcade game being played by an eleven dimensional teenager in his equivalent of MAME? At this very moment his friend could be saying something like "man, this takes me back. Remember when arcades were still popular? I miss the simplicity of gameplay back when everything was just 3D or 4D. And check out the size of those pixels! Crazy how we used to think that looked good, before everything went HD, with those giant blocky Planck units and no antialiasing!"
But I digress.
Vector math has the useful property that we can take a complex 3D problem, visualize and solve it in 2D, then apply our 2D solution back to the original 3D task. We do this all the time, often without consciously noticing the simplification.
But there are other kinds of math that do not generalize from 2D to higher dimensions!
In school, I spent much time solving problems that involved right angled triangles, the angles created by such triangles, the trigonometry that can be derived from these angles, etc. My math education was dominated by this Euclidean approach, where my first reflex was always to sketch the problem on paper, then do math that invariably involved angles.
Trouble is, this way of thinking is not so useful in 3D. There is no obvious 3D equivalent of a right angled triangle. Solutions that depend on angles and trigonometry work well in 2D, but are tricky and sometimes impossible to apply in 3D.
Here be dragons for programmers who are learning 3D. Naturally enough, most people want to keep using the math they learned in school, and which has served them well in previous 2D games. Don’t do it! When there are more than two dimensions, angles are not your friend, and trigonometry should be avoided. Vectors, matrices, and their buddy the dot product will serve you better, thanks to their ability to work the same way with any number of dimensions.