I am trying to position a body using the physics engine with this code:
float touchX = pp;
float touchY = pp;
float diffX = touchX - mBody.getPosition().x;
float diffY = touchY - mBody.getPosition().y;
mBody.setLinearVelocity(new Vector2(( pp) / PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT , ( pp) / PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT));
The X and Y coords are from a TMX tile map and are 32 pixels square, I am trying to get the body in the physics engine to move to certain tiles in a tile map (held in the pp array) but instead it moves to a random chaotic path. Is this the right approach to convert X,Y coords and move to that point??