Pong Tutorial - Ball direction after hitting paddle

I am doing the pong tutorial and I have set up the collision objects like they say and it works, but if the ball starts going at a small angle bouncing off the floor or ceiling it just gets worse and never fixes itself, even if the ball hits the center of the paddle. The have tried to adjust this by doing:
self.direction.y = self.direction.y - dist.y / 150
self.direction = vmath.normalize(self.direction)
What does the dist.y do?
And how does this affect the angle of the ball after hitting a paddle?

defold

Which tutorial is that?

I’m guessing this is the distance from the middle of the paddle?

This one.tutorial

Oh. Craig’n’Dave creates learning materials for teachers and students (in the UK). The tutorials are not created by the Defold Foundation and we do not even have access to them as the tutorials and other material is restricted to Craig’n’Dave users. We can obviously assist as best we can but remember that we do not have access to the projects or the source code.

1 Like

With that said I’m guessing the code you have looks pretty similar to this:

1 Like