Re: [GD-General] Pong ball mechanics
Brought to you by:
vexxed72
From: brian h. <bri...@py...> - 2002-07-31 06:03:58
|
> straight line? My reasoning is this: the bat is flat and perpendicular > to the field of play so anything striking it perpendicularly should > reflect perpendicularly ad infinitum. Holy crap, I never realized that pong was broken, but I think you're right. Heh. "Everything I learned about physics was taught to me indirectly by Nolan Bushnell". To answer your question, pong's paddle physics basically bounce the ball back at an angle proportional to the distance from the center of the paddle. What you set as the max angle is up to you, of course, and I'm not sure if there is an agreed upon standard, but you want to set it steep enough that it's not going to take forever to bounce back across the screen. So basically: int x = ball.x - paddle_center.x; angle = f( x ); where f() is some function that maps a signed distance from the center of the paddle (presumably on the same plane/line as the paddle) to an angle. -Hook |