user1795881
user1795881

Reputation: 11

Box2d libgdx very slow on device

its supposed that, a time step is necesary to run a game at the correct speed, a fast hardware will adjust the speed to 30 or 60 fps, otherwise, the game will run so fast as the hardware can handle it. Now, my game runs as expected on the pc, but, when is launched on the device(galaxy ace), the body moves very slow, even has a maximum speed wich can not exceed, whatever be amount in Body.AppliLinearImpulse or AppliForce, also, i've changed the setLinearVelocity to a very high number, and always is the same speed. could be a bug on libgdx box2d? or a bug with my galaxy ace android 2.3

Upvotes: 1

Views: 1923

Answers (1)

Dmitri Farkov
Dmitri Farkov

Reputation: 9691

You are probably simulating Box2D bodies while passing in the dimensions equal to pixel values. Box2D runs in meters, however, so creating bodies 300 meters in size really puts a low ceiling on your entire simulation.

Recommended approach is to use arbitrary ratio (1m == 64px) and scale down your Box2D system - initialize and manipulate bodies using meter values converted from px.

This will allow for a wider variety of motion and a higher ceiling on velocity. Had the same issue as you and took me a bit of time to figure it out.

Upvotes: 1

Related Questions