+1 vote

1

2

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?

in Engine by (13 points)

1 Answer

0 votes

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.

by (154 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.