C Game Dev Spherical Gravity Game
velocity is a product of change in position with respect to time:
v = (x2 - x1) / (t2 - t1)
And acceleration is a product of the change in velocity with respect to time:
a = (v2 - v1) / (t2 - t1)
You can apply a linear velocity to a unit vector in the normal way:
vector * scalar
And linear velocity in 2-3D can be found by:
vel = sqrt( (x_vel * x_vel) + (y_vel * y_vel) + (z_vel * z_vel))
If you're wanting to track position in 2-3D independently, you'll need to know acceleration, starting velocity and starting position:
x2 = 1/2 * a_x * (tf - ti)^2 + xvi * (tf - ti) + xi
where xi is starting x position, a_x is acceleration in x direction, xvi is the initial x velocity, ti is start or initial time, tf is final time.
Also, the SI value for gravity is 9.81m/(s * s).
So for y (2 and 3D standard axis for elevation)
y2 = 1/2 * -9.81 * (tf - ti)^2 + yvi * (tf - ti) + yi
(I prefer -y being down because that is how all my main modeler works).
Barring the escape velocity threshold, any object traveling up will eventually come back down as t increases. However, escape velocity only applies if gravity decreases with distance from source and should follow the inverse square law, as in Newton's Law of Universal Gravitation(assuming you're not modeling relativistic physics):
http://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation
I used this site to get a good explaination of the runge-kutta integration method:
http://gafferongames.com/game-physics/
Most physics engines use the Euler integrator, but it's not as accurate as the runge-kutta. Newton (http://newtondynamics.com/forum/newton.php) uses Euler and it so failed the integration test, it had to get its own scale of fail. However, it shines when it comes to friction.
Check out:
http://en.wikibooks.org/wiki/Main_Page
There is a reasonable online physics text available:
http://en.wikibooks.org/wiki/Modern_Physics
You'll want mechanics.
http://en.wikibooks.org/wiki/Mechanics
v = (x2 - x1) / (t2 - t1)
And acceleration is a product of the change in velocity with respect to time:
a = (v2 - v1) / (t2 - t1)
You can apply a linear velocity to a unit vector in the normal way:
vector * scalar
And linear velocity in 2-3D can be found by:
vel = sqrt( (x_vel * x_vel) + (y_vel * y_vel) + (z_vel * z_vel))
If you're wanting to track position in 2-3D independently, you'll need to know acceleration, starting velocity and starting position:
x2 = 1/2 * a_x * (tf - ti)^2 + xvi * (tf - ti) + xi
where xi is starting x position, a_x is acceleration in x direction, xvi is the initial x velocity, ti is start or initial time, tf is final time.
Also, the SI value for gravity is 9.81m/(s * s).
So for y (2 and 3D standard axis for elevation)
y2 = 1/2 * -9.81 * (tf - ti)^2 + yvi * (tf - ti) + yi
(I prefer -y being down because that is how all my main modeler works).
Barring the escape velocity threshold, any object traveling up will eventually come back down as t increases. However, escape velocity only applies if gravity decreases with distance from source and should follow the inverse square law, as in Newton's Law of Universal Gravitation(assuming you're not modeling relativistic physics):
http://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation
I used this site to get a good explaination of the runge-kutta integration method:
http://gafferongames.com/game-physics/
Most physics engines use the Euler integrator, but it's not as accurate as the runge-kutta. Newton (http://newtondynamics.com/forum/newton.php) uses Euler and it so failed the integration test, it had to get its own scale of fail. However, it shines when it comes to friction.
Check out:
http://en.wikibooks.org/wiki/Main_Page
There is a reasonable online physics text available:
http://en.wikibooks.org/wiki/Modern_Physics
You'll want mechanics.
http://en.wikibooks.org/wiki/Mechanics