View Full Version : Attention please!

03-04-2003, 01:56 PM
I want a ball to bounce of the walls of a cube(no gravity) according to the rule new_dir = 2((-old_dir)*surface_normal)*surface_normal + old_dir) (hope this is right ). I'm just a beginner in OpenGL and can't seem to get the idea of how this is done. Can anyone help? (Some example code perhaps ) My biggest problem is how to indicate the balls direction (a vector?), how to move the ball according to this direction (the collision I can do...), and how to do the calculation that I wrote above in OpenGL (many many problems!).

Thanks to everyone in advance!

ps. I have tried to search through the q 'n' a's here in search for an answer, but I don't need anything realistic as I have seen described here, just something simple for a beginner.

03-04-2003, 03:33 PM
OpenGL is a graphics language. All it does is graphics. You must implement the equations to deal with physics in your code.

Use vectors. Vectors are your friends.