How to get Ball sideways friction with moving paddle

I am trying to get it to when the ball collides with the paddle it will bounce in the direction the paddle is going instead of just straight up.
Example: if the paddle is moving to the left when the ball hits it it sends the ball back up and to the left and if the paddle is moving right when the ball hits it the ball moves up and to the right and if the paddle is not moving when the ball hots it the ball goes straight up.

So from what I have seen the paddle given to us being used allows for this to happen only because the paddle has angled sides. I am using a different paddle I made which is the typical rectangular paddles you usually find with games like these. How do I add the friction to happen to send the in the direction it should go when it hits the paddle?

Thanks,

Hi,

You could access the Collider2D bounds of the paddle to determine whether the ball hit the left or the right side of the paddle. And based on that information, you give the ball the desired velocity to make it move left and right respectively.

Also please feel free to ask our helpful community of students over on our Discord chat server.

Did this help? :slight_smile:


See also:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms