- Edited
Hello guys I'm new to godot and I'm trying to make a breakout game but I'm having troubles bouncing the ball in the correct way.
I'm using var collision = move_and_collide(velocity * delta)
and velocity = velocity.bounce(normal)
to make the ball bounce, btw the ball is a kinematic body.
It's works well most of the time, but sometimes I get some odd normals. Here is some normals that I printed:
(1, 0) (0, -1) (0, 1) (1, 0) (1, 0) (1, 0) (0.262366, -0.964968) (0, 1) (0.865071, -0.50165) (1, 0) (0, -1) (0.492536, -0.870292) (1, 0) (0, 1)
I just want the ball to bounce with a 45 degree to prevent the ball going horizontally for example.
I don't know if I can publish the code here so I posted on pastebin to not polute the post. Link to code The code is a bit messy since testing with godot but feel free to give sugestions to improve myself :)