Game Development Reference
Platform bounce and friction
Although finding out on which side of the lh]pbkni a collision is occurring is reasonably straightfor-
ward, applying the right physics is a little a bit more complex. You need to find out in what direction
the object is traveling so that it can bounce away at the correct angle.
Lucky for you, you can borrow some formulas used in a branch of mathematics called vector math
to help you sort this out.
To apply the correct bounce and friction when the lh]uan hits the platforms, you need to know three
The direction the lh]uan is traveling in. You can figure this out by using a vector math formula
that calculates a value known as a dot product :
The new direction the lh]uan needs to travel in when it bounces on the platform. In vector
math, this is called the projection :
The lh]uan's speed, in the direction that it's bouncing. This is known as the tangent velocity
and it's used to calculate the platform's friction.