Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

How to get the position in an actor inside a table with LIBGDX?

$
0
0

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


Viewing all articles
Browse latest Browse all 434

Trending Articles