Libgdx line speed not working

I am developing a game with libgdx for the first time. I use this code to set the linear speed of my object to the world of step

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

installation speed

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

The body is configured as dynamic, but there is not enough movement for the object.

: vX = 100 is too small?

+4
source share
1 answer

If your width and height of the game is too large, like 800x480 or something, then divide it by 40, like ... 20x12 ....

this is because box2d speed is limited to 2 units. and what you want is more units per time step, but your screen is too large to achieve this. Therefore, if you reduce your world, then the problem of speed will be solved.

+5
source

Source: https://habr.com/ru/post/1490744/


All Articles