Doing physics in 3D

With the exception of some simple examples in the earlier chapters, the coded examples in this book have all been in 2D. What does it take to do physics in 3D? How do the physics and coding in 3D differ from that in 2D?

3D versus 2D physics

Let's first discuss 3D physics. Most of the physics we've discussed is essentially unchanged in going from 2D to 3D. The fundamental laws of motion for linear and rotational motion remain the same in their vector forms. Particle motion is treated in a similar way, with the difference that in 3D particles can move in an extra dimension (that's obvious, isn't it?). Later on in this section we'll extend the motion classes to 3D, which will allow you to simulate the motion of any number of ...

Get The Essential Guide to Physics for Flash Games, Animation, and Simulations now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.