2
\$\begingroup\$

Well the title says it all, I want to get the position of an actor inside a table

Button button = new Button(bs);
table.add(button).width(50).height(50);
table.top().center();

By using

button.localToStageCoordinates(new Vector2(button.getX(), button.getY()));

I get a near position but not exact, here is an screenshot, red squares are the positions I'm getting, while the transparent squares are the buttons.

enter image description here

\$\endgroup\$
2
\$\begingroup\$

Okay I manage to do it like this:

button.localToParentCoordinates(new Vector2(table.getX(), table.getY()));

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.