Abstract
In this chapter, I will discuss motion and collision. In terms of motion, I will discuss the basics of an object’s linear velocity, linear acceleration, angular velocity, and angular acceleration. I cover Newton’s three laws of motion and the new Physics class we have created to implement these laws of motion. I then discuss a hands-on example that demonstrates with a bouncing and rotating cube how to apply linear and angular acceleration to objects. Next, I cover collision detection and collision response and add code to our Physics class to implement this collision detection and collision response. I then go through a hands-on example where we add in another cube on top of the one from the previous hands-on example and demonstrate our new collision detection and response code. Finally, we create a gravity grid and then demonstrate its use by adding this grid to the previous hands-on example with the two colliding cubes.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have