Problems with Box2D on Andriod

I have two problems with my OpenGL ES Android application running the java port of Box2D

My first problem is that the processing is very, very slow. I am running step with these parameters:

Code: Select all

float timeStep = 1.0f / 60.0f;
int velocityIterations = 10;
int positionIterations = 10;

With these settings, the game appears to run in slow-motion. I can make the game process faster by reducing the step to 30FPS but this limits the max velocity (something I don't want). The processing usually handled at about 16-23ms, I know this shouldn't isn't correct but based on my research this isn't the cause of my problem.


My second problem is that Box2D is not changing body rotations on collisions. If I manually rotate the body and attempt to collide on an angle, the hitboxes are correct.
This image is a result of the rotated box being dropped and falling due to gravity
Image
For both bodies: mass=1, density=10, and friction = 1.3
Sorry for a stupid post, I don't have much knowledge on Box2D. The reason I couldn't find the answer is probably because it's a simple problem but due to drawing in OpenGL it made the first problem a bit more complicated.

Anyways, in case someone end up here with the same problems:
The first problem was due to improper scaling.
The second problem was because I was setting the mass of the bodies after I had set the fixture.

Original thread: https://box2d.org/forum/viewtopic.php?t=10214