3
\$\begingroup\$

I'm trying to call touchUp() for a sprite i've created in my app.

i'm getting success but the co-ordinates do not match while i call it manually.

final int x = (int)mySprite.getX() + 10;
final int y = (int)(Gdx.graphics.getHeight() - (mySprite.getY() - 5));

touchDown(x, y, 0, 0);

this code calls method perfectly but positions do not match. x and y values that i get in touchUp() method is different. it call touch up event of another sprite.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

you have to unproject your coordinates

  getCamera().unproject(new Vector3(actorX,actorY,0))

this method gives you a Vector3 with the coordinates you want. If you want to do the opposite call project() method

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .