Bouncing off horizontal or vertical walls
In the first application of collision physics, we will look at how to make a ball bounce off a straight wall that is either horizontal or vertical in a 2D simulation space such as a floor, ceiling, or room wall. For illustration, we use a vertical wall, but similar principles will apply to horizontal walls as well.
We'll look at elastic and inelastic bouncing in turn (bouncing in which the kinetic energy of the ball is or is not conserved).
Elastic bouncing
If the ball bounces elastically off a wall, its kinetic energy just after bouncing must equal its kinetic energy just before bouncing. Because k.e. = ½ mv2, this implies that its velocity magnitude is unchanged by the collision.
Consider first a special ...
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.