4

I am developing a game with libgdx for the first time. I am using this code to set the linear velocity of my object stepping world

world.step(Gdx.app.getGraphics().getDeltaTime(), 6, 2);

setting velocity

body.setLinearVelocity(new Vector2(new Vector2(100, 100)));

Body is set to be dynamic, but there is no sufficient movement for the object.

is vX = 100 too low ?

4

1 回答 1

5

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

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

于 2013-07-10T17:34:49.100 回答