PDA

View Full Version : physic simulation bouncing ball



farien
05-09-2017, 09:14 PM
Hello,
if I want to make the ball fall on flat surface and then bounce, do I have to create the flat surface?

farien
05-10-2017, 01:14 AM
Hello, I want to make the ball falling at flat surface and then bounce until it stop just like in the real life. I'm using opengl glut in codeblock. I'm still the beginner. What I understand, I need create the class for ball and flat surface. Then I need to implement the physics formula into the coding. my problem is, I don't know how to code the formula. how to set the maxHeight of ball, the speed and then when the ball at the surface, it will bounce until finally stop due to friction and energy loss.

OceanJeff40
05-14-2017, 08:57 AM
If you're talking about doing this in 3D, maybe if you're not sure how to do this, try 2D first?

One thing with the Physics that I can tell you from the top of my head, is that the Acceleration will be constant (gravity). So speed will increase (acceleration) at a constant rate. Usually this is added every frame.

You may have inspired me to try this in 2D today. Thanks and good job. Best of luck in all your OpenGL Endeavors, also, I have a YouTube channel for OpenGL Tutorials, check out the link below:

https://www.youtube.com/channel/UCzx8alrxVELz5h1dfCdkdfg

Thanks,
Jeff