-
3d pong physics
hey everyone. currently im making a 3d pong game. im getting to the point of writting the ball class, and have come to the conclussion that i really have no idea how the physics would work. like, how can you detect the angle of incidence and what not... and whats the proper way of reflecting the ball...
any web sites or ideas on where to start?
-
Wouldn't the angle of incidence be related to the ratio of the vertical and horizontal components of the ball's speed? I.e. if both components are the same, a one-to-one ratio, then the ball must be travelling at a 45 degree angle. If the horizontal component is twice as much as the vertical, then the angle would be 26.56 degrees (I think) off the horizontal axis. Inv-Tangent of (1/2) = 26.56
-
I'll just say what needs to be done, and you can either research it further or ask me questions if you really cannot figure out what I mean:
To start, all you need to do is when a ball collides with something, you reverse the component of the velocity which is normal to the surface being hit.
This is called a perfectly elastic collision in which the magnitude of the relative velocities of the colliding objects stays the same.
-
if u want links look three threads up. Heck i even made it sticky for crying out loud.
http://cboard.cprogramming.com/showthread.php?t=33318