Sign in to follow this  
DevLiquidKnight

Pong Paddel + Ball Stuck Problem

Recommended Posts

I recently made another clone of pong because I was bored using a different graphics library. One particular issue I keep having is when I make my game of pong the ball tends to get "stuck" on the paddle. The collision detection is fine it detects it perfectly. The problem seems to happen when the ball hits from an angle. Say from the corner or the side and the user is going the direction it hit. I am unsure of how to make it so the balls X axis would become inverted when this happens. Could someone please enlighten me and explain how to remove this issue.

Share this post


Link to post
Share on other sites
When you check collision, don't only check the positions. Also check whether the velocity vector of the object is bringing the object more inside the other object you are testing against. if the velocities point away from each other, then there's no need to adjust the velocity again, is there?

In your case I think your collision loop ends up negating the X value over and over again, thus making the ball jittering on the edge or inside the paddle.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this