【发布时间】:2014-07-05 03:42:41
【问题描述】:
我有 Group 对象,这些对象由其他 Group 对象组成,最终由 Actor 对象组成。现在,当组和演员旋转、偏移和缩放时,“世界”中的坐标或相对于根节点的坐标会发生变化。如何获取演员本地空间中某个点的世界坐标?
为了说明更多,这是我想要的一个例子:
Group parentGroup;
Actor childInGroup;
...
parentGroup.addActor(childInGroup);
childInGroup.setPosition(10f, 15f);
childInGroup.setRotation(45f);
// Get the childInGroup's position in the world
float childWorldPosX = ...; // This is what I want to know
float childWorldPosY = ...; // ... and this.
【问题讨论】:
-
Actor.localToParentCoordinates()或Actor.localToStageCoordinates() -
@noone 谢谢!介意将此作为答案发布,以便我接受吗?
标签: libgdx coordinates scene2d