# XNA Essentials

## Game Programming for Xbox 360, PC + Windows Phone

### Chapter 16 page 333 Errata

On page 333 in the XNA Game Studio 3.0 Unleashed book, at the bottom there are two equations for solving final velocity.

v1f = ( (e + 1)m2v2 + v1(m1 - em2) ) / (m1 + m2)   //this one is ok

v2f = ( (e + 1)m1v1 - v2(m1 - em2) ) / (m1 + m2)  //this equation has a typo in the underlined portions

After checking algebra for both formulas against the derivation using the Coefficient for Restitution and Conservation of Momentum (source: http://en.wikipedia.org/wiki/Coefficient_of_restitution), I found that I could transform the first equation to the format found on that wiki page to the book's version, but not the second.

I checked against the code sample on page 336 to see that the code sample's equivalent of the equation was written as:

( (e + 1)m1v1 + v2(m2 - em1) ) / (m1 + m2)

I can transform the wiki's version to the equation that was written into the code sample, so that verifies the code sample is using the correct formula. That second equation for solving final velocities on page 333 needs to be corrected.

Edit: The "-" is underlined for the sake of changing it to the way the code sample's version has it written, for consistency. The true issue is that the coefficient of restitution, e, is  multiplied by the mass of m2, when for the second formula is should be multiplied by the mass of m1.

CodyDuncan - Saturday, September 3, 2011 @ 4:23 AM