Pendulum and Swing physics

Started by
0 comments, last by blaze02 17 years, 7 months ago
Hello, Can anyone point me in the direction of a good tutorial on 2D pendulum and swing physics? I've searched over this forum and google and have yet to find a tutorial that explains how to implement a realistic pendulum motion. My main concern here is accuracy. Just a side not, I'm using c++ and allegro for a graphics api. Thanks in advance.
Advertisement
I would look into understanding the physics of the problem if you are trying to get a realistic simulation. I'm sure you can google just as well as I can, so I'll just.....
*cough*
http://www.myphysicslab.com/pendulum1.html
*sneeze*
http://www.physicsclassroom.com/mmedia/energy/pe.html
*gulp*
http://scienceworld.wolfram.com/physics/Pendulum.html

If you are going for ultimate accuracy, I would suggest that you do not use a timestep method that may seem fairly intuitive. I.e: You could calculate the force, then apply the force over a timestep of say 1/60th of a second. The problem with this method is that the pendulum moves in a linear fashion during the timestep... thus, if your timestep goes up, the pendulum gets more and more "off course".

For the best accuracy, I would simply create an equation based on the length of the pendulum's "rope". Then plug the time into the equation each frame and recalculate the position each frame.

Hope that helps.
-------Harmotion - Free 1v1 top-down shooter!Double Jump StudiosBlog

This topic is closed to new replies.

Advertisement