9 Simulating moving objects
This chapter covers
- Implementing Newton’s laws of motion in code to simulate realistic motion
- Calculating velocity and acceleration vectors
- Using Euler’s method to approximate the position of a moving object
- Finding the exact trajectory of a moving object with calculus
Our asteroid game from chapter 7 was functional but not that challenging. In order to make it more interesting, we need the asteroids to actually move! And, to give the player a chance to avoid the moving asteroids, we need to make it possible to move and steer the spaceship as well.
To implement motion in the asteroid game, we’ll use many of the same calculus concepts from chapter 8. The numerical quantities we’ll consider are the x and the y positions ...
Get Math for Programmers 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.