Calculate angle of moving ball after collision with angled or sloped wall that is a 2D line segment
Posted
by
Ben Mc
on Stack Overflow
See other posts from Stack Overflow
or by Ben Mc
Published on 2010-12-24T00:15:13Z
Indexed on
2010/12/24
0:54 UTC
Read the original article
Hit count: 242
android
|game-physics
If you have a "ball" inside a 2D polygon, made up of say, 4 line segments that act as bounding walls, how do you calculate the angle of the ball after the collision with the irregularly sloped wall?
I know how to make the ball bounce if the wall is horizontal, vertical, or at a 45 degree angle. I also have my code setup to detect a collision with the wall.
I've read about dot products and normals, but I cannot figure out how to implement these in Java / Android. I'm completely stumped and feel like I've looked up everything 10 pages deep in Google 10 times now. I'm burned out trying to figure this out, I hope someone can help.
© Stack Overflow or respective owner