I've just started with Box2D and have come across a strange problem.
I have a simple function to constrain object position to within a predefined area.
I do this by getting the body's world position, checking this against the predefined area's bounding box values, and applying a force to the body to keep it within.
if (bodyWorldPos.x >= worldWidth)
body.setLinearVelocity(...);
This works fine.
However, if the body collides with another body, this simple method stops working. The body's world position, retrieved like this:
body.getWorldPoint(body.getPosition())
returns wrong values.
Is this a bug in Box2D for LibGDX or am I doing something wrong?