1

Similar to this question: https://stackoverflow.com/a/23701065

But I was wondering if there is a way to get the current rotation for the child of a group instead of the position?

For example:

Group g1 = new Group();
Group g2 = new Group();
Actor a = new Actor();
g1.addActor(g2);
g2.addActor(a);
g1.setRotation(90);
g2.setRotation(45);
//How to get `a` actual rotation in reference to stage?
Community
  • 1
  • 1
DoubleDouble
  • 1,493
  • 10
  • 25
  • 1
    You could sum up all rotations the actor itself and all parents until you reach the root. – noone Oct 23 '15 at 06:58

1 Answers1

0

To expand on @noone's comment and put what I ended up with:

I have already extended Group with my own subclass, so I just added the following method:

/**
 * Returns the total rotation of the parent grouping.
 * Does not include this group's rotation.
 **/
public float getTotalParentRotation()
{
    Group g = this.getParent();
    float rotation = 0.00f;
    while (g!=null) {
        rotation += g.getRotation();
        g = g.getParent();
    }
    return rotation;
}
DoubleDouble
  • 1,493
  • 10
  • 25