Ball Bounce Problem

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Metehan Özbek



As in the first screenshot, the ball is moving in the direction I specified with raycast2d. I show the next direction from the collision point with the second raycast2d, but it acts as in screenshot 2 due to the way the ball collides. How do I get Raycast2d to show the right direction?

:bust_in_silhouette: Reply From: razah

Create a new invisible edge for the raycast2d and slide the red edge down the length of the radius of the ball. wall.y += ball_radius.

You need to draw the line according to the center of the circle, not the edge.