libgdx - How to get the world coordinates of a point in a child actor? -
i have group
objects consist of other group
objects, consist of actor
objects. now, when groups , actors rotated, offset , scaled, coordinates in "world", or in relation root node change. how world coordinates of point in actor's local space?
to illustrate bit more, here's example of want:
group parentgroup; actor childingroup; ... parentgroup.addactor(childingroup); childingroup.setposition(10f, 15f); childingroup.setrotation(45f); // childingroup's position in world float childworldposx = ...; // want know float childworldposy = ...; // ... , this.
you can either use actor.localtoparentcoordinates()
if want go 1 step higher in hierarchy of groups
, actors
, or directly use actor.localtostagecoordinates()
"stage-global" coordinates directly. in case, libgdx recursively apply localtoparentcoordinates
until hits root element of stage.
Comments
Post a Comment