I've no idea, but it must have something to do with Friction. Air??? so as it moves, a tiny fraction of air resistance has to be removed?? Purely a guess.
Simple way is to add a variable called gravity that = 1. Then every time it reaches the highest point of which it can go the amount of force applied for it to go back around the other way is reduced by the amount of gravity there is.
Or another way of doing it which will make the gravity change as it moves up and down would go something like this.
initiate a variable called gravity that = 0. have a check in the act that will make the gravity be equal to : (length of wire - distance between y coordinates of center point and the ball) / 10.
Then make a check in the area of code where it applies the force which will do :
If the ball is going downwards (Dipping down in the U shape) the force applied will + the amount of gravity there is. Otherwise if the ball is going upwards the force applied will - the amount of gravity.
By the way i do not understand what your code is saying that is why i am not giving you a fully formated piece of code to you, what i have given you is based on the information i can see from watching what the scenario is doing.
I would like it (if you haven't already) if you implemented the equation for the period of a pedulum: that is 2*PI*sqrt(Length of string (in meters)/9.8 meters per sec)
That is all in meters and assuming you are doing this on earth: so if you want to change it to your own variables, the basic equation is this: 2*PI*sqrt(length of pendulum/Gravitational acceleration)
Is there anyone that can look at this code, try and understand it, and then suggest ways of incorporating gravity so the pendulum will slow down to a stop, rather than continuously?
2012/1/14
2012/1/14
2012/10/10
2012/10/10
2012/10/10
2012/10/10
2012/10/10
2012/10/10
2012/10/10
2012/10/10
2012/10/10
2012/10/10
2012/10/10
2012/10/10
2013/2/13