We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello! Im trying to get the ball to bounce off the center circle and the edges of the canvas. I've been successful with the edges but i'm having some issues with the circle in the center. Cant figure out how to get the ball to bounce off naturally then right back to where it was. I see that examples that are somewhat similar to this use vectors. I do not want to use vectors because i am very new to programming and haven't been taught how to use them. I would like to figure this out using trig but don't know how to approach it
Answers
please don't post duplicates
so you're just reversing BOTH directions if the small ball hits the circle. this isn't what you want.
you need to treat it as if it's hit a wall at a tangent to the circle at the point of contact. here's a tutorial:
http://ericleong.me/research/circle-circle/#static-circle-collision
I couldn't do it
I also think there are minor errors on the tutorial page of eric
Watch your integer division with BALL DIAMETER / 2
thanks!
i think it occurs in 10 places