1

I'd like to start writing and incorporating my own 3D physics engine in to my game engine, and after doing a little research in to what one might need to have a firm grasp of before doing such a thing it started to seem a little daunting.

I've found that apparently Classical Mechanics (Goldstein and friends) is a great book on classical/Newtonian mechanics which is where I think I would like to end up, but I'm sure that if I started diving in to it I would be overwhelmed, not understand much, and ultimately lose motivation.

I think my intuition for mathematics in general is okay but I never really applied myself very much in school until it was too late and I didn't have the foundations to carry me. I have heard that mathematical methods (I'm not even confident I know what that is) and calculus are good to know before diving in to classical mechanics but it would really help to gather opinions on what the best route forward is. I'm in no rush and I'm eager to learn, but I'm just worried about reading the wrong material or material I'm not ready for and then being put off.

Qmechanic
  • 220,844

1 Answers1

3

The answer depends greatly on what you want to do with this physics engine. To make a "reasonable" one, $F=ma$ and $\tau=I\omega$ are really all you need.

The answer gets squirley from there.

First off, most game physics engines are horrible physics emulators. This is because their goal is not to accurately predict what will happen in a system. Their goal is to make the player feel like the physics is real while staying in the confines of the processing power available to the engine. Quite often the physics is flat out wrong -- not by accident but by intent. Often the wrong physics is far easier to compute while still being "good enough" for human eye balls.

Other physic engines are more accurate. It should be no surprise that flight simulators tend to get the physics of flight more correct than other engines! If you are making a flight simulator, you probably will want to brush up on your aerodynamic physics. But even here, you will find assumptions made to simplify things. Most flight simulators are not very accurate on the precipice of a stall, where the fluid dynamics over the wing can get complicated enough to require computational fluid dynamics (CFD), which does not get done well in real time!

The most common thread in all of these engines will not be physics based at all, but practical. You will compute the physics using floating point numbers, and there are numeric issues such as roundoff that arise from doing this repeatedly. You will spend time making sure that your systems don't blow up when this occurs (I've had more than one infinite loop occur because I can have two finite floating point numbers, $a$ and $b$, such that $b>0$ and find that $a+b=a$ because floating point addition is approximate.) You will also find many issues arise with the finite numeric techniques you have to use because computers can't use real numbers and continuous operations. More than one game puzzle has been defeated by a player that figures out how to move something fast enough to break the collision detection algorithm and walk right through a wall.

If you really want to build an engine (and I'd second G. Smith's comment about using an open source one), I'd look into how physicists and engineers structure their problems to avoid these numeric instabilities.

Cort Ammon
  • 53,814
  • 6
  • 103
  • 176