Libgdx线速度不起作用

Shi*_*nga 4 java box2d libgdx

我是第一次用libgdx开发游戏.我正在使用此代码来设置我的对象步进世界的线速度

world.step(Gdx.app.getGraphics().getDeltaTime(), 6, 2);
Run Code Online (Sandbox Code Playgroud)

设定速度

body.setLinearVelocity(new Vector2(new Vector2(100, 100)));
Run Code Online (Sandbox Code Playgroud)

正文设置为动态,但对象没有足够的移动.

是vX = 100太低了?

Vik*_*ain 5

如果您的游戏宽度和高度太大,如800x480或其他东西,则将其除以40,如... 20x12 ....

这是因为box2d速度限制为2个单位.你想要的是每个时间步数更多的单位,但是你的屏幕太大而无法实现这一点..所以如果你缩短你的世界那么速度问题就会得到解决.