

Then the idea is to see if you can solve the problem in some other way since you have exact knowledge of all the conditions.

The trick is to understand the physics model that you're trying to model. Bouncing a ball off an irregular object with flat facets.Īlthough this isn't as complex as the general elastic collision, it still takes a bit of trigonometry, so there's got to be a simpler way! And of course there is.

Thus all we need to do to bounce an object off a pool table-like environment that consists of hard edges that have large mass is to compute the normal vector direction, the direction that the object struck at, and then reflect the object at the same angle as shown in Figure 13.21. When a ball hits one of the sides then it always reflects off the side at an angle equal and opposite to its initial trajectory, as shown in Figure 13.20. The balls have very small mass in comparison to the pool table. If one object collides with another object that has mass much greater than the colliding object, then the collision is much simplified since we only need to figure out what happened to the single object that's doing the colliding rather than two objects. Given the object has initial velocity (xv,yv), the object can hit any of the four sides of the screen. It depicts a fairly common collision problem in games, that is, bouncing an object off the boundaries of the screen. Game programmers that don't know anything about elastic or inelastic collisions have been faking collisions for years and we can do the same. Before I show you the real way to do it let's use the other side of our brains. Most video games don't even try to mess with non-elastic collisions and stick to simplified elastic collisions since they themselves are hard enough to compute. Elastic collisions are collisions where both kinetic energy and momentum are conserved in the colliding objects while non-elastic collisions don't conserve these values and energy is converted to heat and/or used for mechanical deformations. As I explained earlier in the chapter, two kinds of collisions exist: elastic and non-elastic.
