与此问题类似:https://stackoverflow.com/a/23701065

但是我想知道是否有一种方法可以获取组中子级的当前轮换而不是职位?

例如:

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?

最佳答案

为了扩展@noone的评论并给出我最终的结论:

我已经用自己的子类扩展了Group,所以我只添加了以下方法:

/**
 * 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;
}

关于java - LibGdx如何获取小组 child 的总舞台旋转?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33293498/

10-13 00:02