Physics Tutorial Needed

BlitzMax Forums/BlitzMax Beginners Area/Physics Tutorial Needed

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I found something very useful. Believe it or not, the following post by a programmer that goes by the name of "zppz" explained to me the things I needed to hear. Particularly information about acceleration and gravity, which is what I really needed to figure out.

Please look at this, and because this helped me out and I am math-retarted, I wanted Wave to put this in his upcoming documentation:
(the helpful info below is from: http://forums.indiegamer.com/showthread.php?p=63995#6)

Let's narrow it down to three variables only, by assuming the ball is dropping straight downwards.
y : this is the current height of the ball
dy : this is how far the ball will move this time, ie. how much y will change
ddy : this is how much dy will change this time

You could also call these position, velocity and acceleration.

As an example, start with the ball at height 10, and dy = -1 so it is already on the way down.
If we did not have ddy this would happen:
y = 10, dy = -1
y = 9, dy = -1
y = 8, dy = -1
y = 7, dy = -1
...etc
The ball just moves steadily downwards at a constant speed, very unrealistic.

So we need to have a little ddy aka acceleration aka gravity for this case, let's make it -0.2 because we want things to fall downwards
y = 10, dy = -1, ddy = -0.2
y = 9, dy = -1.2, ddy = -0.2
y = 7.8, dy = -1.4, ddy = -0.2
y = 6.4, dy = -1.6, ddy = -0.2
...etc
Now as the ball moves down, the rate at which it moves down increases as we expect.

Same goes for throwing a ball upwards from the ground:
y = 0, dy = 1, ddy = -0.2
y = 1, dy = 0.8, ddy = -0.2
y = 1.8, dy = 0.6, ddy = -0.2
y = 2.4, dy = 0.4, ddy = -0.2
y = 2.8, dy = 0.2, ddy = -0.2
y = 3.0, dy = 0.0, ddy = -0.2
Here you can see that in the last loop the velocity has become zero. This is also what you expect a ball to do at some point after you throw it upwards... what goes up must come down


As for the hitting the ground part, you simply change the direction the ball is moving in, that is, multiply dy by -1

(the helpful info was originally from: http://forums.indiegamer.com/showthread.php?p=63995#6)