Is there an upper limit on velocity when using box2d?

断了今生、忘了曾经 提交于 2019-11-28 13:23:51

It took me pretty long to understand that now, but there actually really IS a hard limit on velocity in Box2D. See here:

There is a maximum movement limit of 2.0 units per time step, given in the file b2Settings.h in the source code.

If you have one step per frame at 60FPS, then your bodies can move at a maximum speed of 120m/s. Maybe this will save somebody a bit of time one day.

Yes, there is a difference between which size do you use. Box2d operates over floating point numbers and thus it's precision is limited and simulation quality differs. Box2d is tuned to work best with dynamic bodies of size 0.1 to 10.

So generally you should prefer to use one units for physics and other for graphics

Now to your question. Body's velocity is affected by collisions, friction (if one body is sliding over the other) and by linear damping. So check what value for linear damping do you use (it's non-zero by default as I remember). There are no velocity limitations, as far as I know, but higher velocity will provide less quality collisions if using the same time step.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!