Question

I'm trying to create this game (break the wall) and I have a question : When the ball hits the paddle it's angle should change accordingly, but how? Any one knows and can help me?

thank you!!

Était-ce utile?

La solution

As Soner wrote, it is impossible to tell without seeing some code. So this answer makes some assumptions that might or might not apply to your code. Anyway, the problem could be solved as follows:

Assume that we have the ball's direction and velocity as a vector. The paddle's normal will be a vector, too. Then you need to reflect the velocity at the normal with

velocity := velocity - 2 * normal * dot(normal, velocity)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top