Welcome to PF!
bnpla said:
I'm tyring to code an engine that simply adds gravity to the world.
I know that gravity is a constant value added to the velocity of an object on each second, like this:
Velocity = Vi * t + 0.5 * G * T2
Just a complaint about terminology: I would not say that gravity IS a constant value added to the velocity of an object each second. Gravity is a force. It is true that the force of gravity ADDS a constant value to the (vertical) velocity of a falling object each second. In other words, the force of gravity causes a constant
acceleration. That is its effect. The change in velocity in one second due to this acceleration is what you described above. You might think I'm being pedantic, but it is important to distinguish between different types of quantities in physics. Gravity is a force, and a force is not the same thing as a velocity or an acceleration. A force causes an acceleration, which implies a change in velocity.
bnpla said:
What I'm tyring to figure out, is the distance traveled of an object falling from any point in time, without having the values of the initial time or initial velocity...
Let's say i drop a coin from some distance to the floor. Now let's say i stop the time at some X seconds. I want to know how much the coin will move in the Y axis only knowing the velocity of the coin at that particular time and nothing else.
I don't want to know the total distance since i dropped the coin. I want to know the distance that the coin will travel starting from the moment i paused the fall to 1 second forward in time.
You can still use the same equation and just take NOW to be the initial time, and "one second from now" to be the final time. So, in this situation, v
i is the velocity
now which we are taking to be the initial velocity. The important thing to remember is that the equation is actually:
d = v
i Δt + (1/2)a(Δt)
2
where Δt is the difference between the final time (after the distance has been travelled) and the initial time. Normally, we take the initial time to be t = 0, and the final time, t is the amount of elapsed time "up to now", so that Δt = t - 0 = t, and it's just fine to replace Δt with t. But if you're not starting at t = 0, then that's not the case.
Example:
You're watching a recorded video of me dropping a coin. Suppose, at t = 0, I dropped the coin (i.e. I released it from rest) from a height of 1 metre. Suppose that you come into the room 3 seconds after the video had already started. So you don't know what the initial height was. All you know is that right now at this instant (at t = 3 s) it is falling at a speed of 29.43 m/s. (Somehow you were able to determine this -- who cares how). Now, you want to determine how far it will have fallen (below its current height) one second from now, at t = 4 s. All you have to do is take the initial time t
i to be 3 s , and the final time, t
f to be 4 s. Then Δt = t
f - t
i = 1 s. In this time interval, the object will fall a distance:
d = v
i Δt + (1/2)a(Δt)
2
= (-29.43 m/s)*(1 s) + (1/2)(-9.81 m/s
2)*(1 s)
2
= -29.43 m - (4.905 m/s
2)*(1 s
2)
= -34.335 m
Notice that the ONLY numbers I used in the calculation above were: 1. the time interval I was interested in (1 s), 2. the velocity at the beginning of that time interval, and 3. the acceleration due to gravity.
A slight flaw with my example is that an object dropped from a height of 1 m would hit the floor long before t = 3 s, but who cares? It's irrelevant to the example. This is the distance that a freely falling object with that initial downward speed will fall in 1 second regardless of where or how fast it started.