How to get world coordinates of a point in a child actor?

I have objects Groupthat consist of other objects Groupthat finally consist of objects Actor. Now, when groups and actors rotate, shift and scale, coordinates in the "world" or in relation to the root of the node change. How to get the coordinates of the world of a point in the local space of an actor?

To illustrate a little more, here is an example of what I want:

Group parentGroup;
Actor childInGroup;
...
parentGroup.addActor(childInGroup);
childInGroup.setPosition(10f, 15f);
childInGroup.setRotation(45f);

// Get the childInGroup position in the world
float childWorldPosX = ...; // This is what I want to know
float childWorldPosY = ...; // ... and this.
+4
source share
1 answer

Actor.localToParentCoordinates(), Groups Actors, Actor.localToStageCoordinates(), "stage-global" . libGDX localToParentCoordinates, .

+5

Source: https://habr.com/ru/post/1540867/


All Articles