Jump to content
  • Advertisement
Sign in to follow this  
Endemoniada

Circle-Point Collision Response

This topic is 2831 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

Hi guys,

I have a 2D ball (circle) hitting a corner and I don't know how to reflect the ball as a response.

I think I should move the ball to the point of collision, then compute a normal and reflect off that but I can't figure out how to make the normal. Do I first make a vector from the center of the circle to the corner point, then make a perpendicular one to that and use it as the normal ? If that's the way how do I make sure the normal is facing the right way ?

Am I on the right track ?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Endemoniada
Do I first make a vector from the center of the circle to the corner point, then make a perpendicular one to that and use it as the normal ?
Just the first part, more or less; the collision normal will be parallel to the vector from the corner point to the circle center (which direction you want it to point is up to you).

Share this post


Link to post
Share on other sites
Here's an image that might help. If the circle moves in the direction of u before the collision, then it should move in the direction of v after. In this image the normal is the center-point minus the corner point.


The following page also shows how to calculate it. They have the normal the other way, so the plus in the equation turns to a minus.
http://mathworld.wolfram.com/Reflection.html.

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!