質問

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!!

役に立ちましたか?

解決

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)
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top