# Homework Help: Calculate ball velocities after slope bounce

1. Jun 14, 2012

### DrKrunklehorn

1. The problem statement, all variables and given/known data

Hello! I'm working on my final project for a programming class. Currently I can successfully
detect 2D collision between a ball, and a line that can rotate in any direction.

However when the ball hits the line I need to change it's velocity so it bounces
in the right direction. I'm not worrying about elasticity or friction or anything, just
post collision direction.

2. Relevant equations

I know basic Trig is involved and maybe Dot product, but I'm pretty sure we don't need that.

3. The attempt at a solution

I thought if the racket was horizontal, it would be as easy as incident angle = reflection
angle. But as the racket tilts upward I pictured the reflection angle decreases at the same
time.

So I tried taking the racket's rotation relative to the ground and subtract it from the ball's
movement angle. This I thought would be the new angle of reflection.

Sadly it didn't work out. Sometimes the ball sort of bounces in the right direction but it's
really shoddy.

Thanks for the assistance!

2. Jun 15, 2012

### Simon Bridge

Why not work out the vectors for the case that the racket is at zero degrees then rotate the vectors by the racket angle using either matrix or quaternion methods. You may need to detect if that ball hits the top or the bottom of the racket.