0

With only 1 dimension, you want to get to position X and stop there. you have a maximum acceleration A you can apply yourself; each frame you choose what direction to accelerate.

So if you have a velocity V, and want to stop at position X as fast as possible, how much of your maximum acceleration A do you apply yourself?

(If you are far away, you apply your maximum acceleration, but when you are close, you start braking. So based on your velocity and remaing distance, you need to decide when you begin to brake.)

4

2 回答 2

1

控制方程是 x = vt + 0.5 at^2,其中 x 是距离,v 是速度,t 是时间,a 是兼容单位的加速度。

在没有其他限制的情况下,为了尽量减少您的旅行时间,您将始终应用最大加速度:向目标方向加速直到到达一半,然后向原点方向加速直到停止。

如果您有最大速度,请加速直到达到最大速度,这将发生在距离原点 X 一定距离处。当你离目标距离 X 时,加速回到原点。

于 2013-04-25T17:01:26.353 回答
0

只是加入我最近解决的这个问题的更高级版本的答案。您在 x_0 处有 v_0,并且想要到达位置 X,并且到达那里时的速度为 V。每个小时间步都应用加速度,例如每秒 60 次。

因此,使用运动方程 x = vt + 0.5 at ^2,在施加正/负加速度的情况下求解 t,以查看无论最终速度如何,都能以多快的速度到达 x。

还可以通过应用正加速度或负加速度来计算达到 V 所需的时间。无论 t 最高,是应用的正加速度或负加速度。

这会导致对象平滑地遵循诸如 sin(x) 之类的路径,如果它们被扔掉,它们会优雅地滑回其中。

于 2019-02-20T11:32:43.447 回答