- #1

Moon54

- 17

- 1

Let's assume we have a distance, let's say it's 100000 units of any type, could be virtual since i am trying to program a 3d physics engine.

The object pass that distance in 1500ms in the first revolution, second one would be 1700ms. Now i have to calculate the speed, it will be:

100000 / 1500ms = 66,66 (Begin speed)

100000 / 1700ms = 58,82 (Ending speed)

Now as the deceleration formula says:

66,66 - 58,82 = 7,84

7,84 / 1700ms = 0,0046117647058824 ~ 0,0046118

That means the object losses 0,0046118 for 1ms.

The biggest issue with these calculations is it just doesn't fit the expected time or distance.

So if i do something like this:

speed = 66,66 - 0,0046118 = 66,6553882;

then i move the object in the system: distance += speed(66,6553882);

I will keep doing it for the next 1699ms left, i will found that the distance don't fit. The object should travel 100000units, in 1700ms, it don't have to be 100% accurate, but it should fit.

I did few simulations with the exact parameters, and what is going to happen, is the object will travel around 20% extra distance, or if i change the deceleration, the distance will be correct but the time will drastically change.

I found that the only way to imitate the real world movement is using average speed without deceleration, and when the object complete specific distance, change the speed to the next one, we just measure, in that case both time and the distance will be correct, but how can i imitate the deceleration loss per 1ms? There must be a way to get the data by timer, and do it. When the object lose speed, they do it by smaller intervals, then 1 second or even more.

I need help to finish my project, i will need accurate movement system and all what i have to do, is find a way to move the object by 1ms, and subtract the deceleration value at that time.