Jump to content
  • Advertisement
Sign in to follow this  
DevLiquidKnight

Pong Paddel + Ball Stuck Problem

This topic is 4472 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!