Bouncing the ball off the circle

So I make a game like a volleyball train. Basically, my two main players, or objects, are half circles on either side, I have a set in the middle and a ball. My problem is that I cannot figure out how to make the ball bounce a semicircle so that it matches both the angle and direction. I tried to find it, but they are all either about walls or rectangles and not bouncing off a round object. Any code or ideas will help.

+3


source to share


1 answer


"Take a semicircle, draw it up, roll the parallel rays of light straight down, and let those rays bounce off it. The envelope of the reflected rays will be half nephroid ":


      ParallelRaysCirc





      Image source: John Baez .
More directly, suppose you have a ray r along your ball path. Find the intersection point p of r with the semicircle C. Calculate the tangent line t at p. Calculate the normal n at p. Flip r over n to r '.
+1


source







All Articles