How can I implement multiple touch in Box2D?

125 Views Asked by At

I want to move two bodies on a android phone using two separate touch's, Is this possible?

1

There are 1 best solutions below

3
On

You can get coordinates of first and second touch with following methods

int firstX = Gdx.input.getX(0);
int firstY = Gdx.input.getY(0);
int secondX = Gdx.input.getX(1);
int secondY = Gdx.input.getY(1);

Use them to move your objects.

You can read more in libgdx documentation