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\$

1 Answer 1

2
\$\begingroup\$

Okay I manage to do it like this:

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

\$\endgroup\$

You must log in to answer this question.

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