I attempting to write simple game that include player sprite and obstacles. I have implemented a physics world with gravity. I would like when player sprite falling it will be near the obstacle where it falling from, but with gravity the the sprite falling in diagonal and not straight down.
mPhysicsWorld = new PhysicsWorld(new Vector2(0, SensorManager.GRAVITY_EARTH), false);
...
public Player(PhysicsWorld world, final float pX, final float pY, final TiledTextureRegion pTextureRegion,
final VertexBufferObjectManager pVertexBufferObjectManager)
{
super(pX, pY, pTextureRegion, pVertexBufferObjectManager);
mPlayerDeff = PhysicsFactory.createFixtureDef(0, 0, 0);
mVertexBuffer = pVertexBufferObjectManager;
mBoardManager = BoardManager.getInstance();
mDirection = DIRECTION_RIGHT;
mWorld = world;
mBody = PhysicsFactory.createBoxBody(mWorld, this, BodyType.DynamicBody, mPlayerDeff);
mWorld.registerPhysicsConnector(new PhysicsConnector(this, mBody, true, false));
}
You can try to set mass data to your body: