可变时间步和加速度

3 c math physics

要使用可变时间步长移动对象,我只需要:

ship.position += ship.velocity * deltaTime;
Run Code Online (Sandbox Code Playgroud)

但当我尝试这个:

ship.velocity += ship.power * deltaTime;
Run Code Online (Sandbox Code Playgroud)

我在不同的时间步骤得到不同的结果.我怎样才能解决这个问题?

编辑:

我正在模拟一个物体在一个轴上落到地面上,一个固定的力(重力)作用在它上面.

Bri*_*son 8

ship.position = ship.position + ship.velocity * deltaTime + 0.5 * ship.power * deltaTime ^ 2;
ship.velocity += ship.power * deltaTime;
Run Code Online (Sandbox Code Playgroud)

http://www.ugrad.math.ubc.ca/coursedoc/math101/notes/applications/velocity.html

方程的速度部分是正确的,它们必须在每个时间步都更新.

这一切都假设你在belisarius指出的deltaTime上有恒定的功率(加速度).