【发布时间】:2018-04-16 20:12:24
【问题描述】:
我正在尝试从Plane 上的屏幕坐标中找到世界坐标,其中mCamera 是PerspectiveCamera。
public Vector3 getWorldCoordinates(float x, float y) {
// Use an imaginary plane at z=0 to intersect ray
Plane plane = new Plane();
plane.set(0, 0, 1, 0);
Ray ray = mCamera.getPickRay(x, y);
Vector3 pos = new Vector3();
Intersector.intersectRayPlane(ray, plane, pos);
return pos;
}
如何修改此例程以在找到坐标之前在 X 轴上旋转 Plane x 度数?
是否有任何简单的内置 libgdx 例程用于旋转平面,例如使用 Camera.rotate(Vector3.X, degrees) 的 Camera?
【问题讨论】:
-
将 Vector3 设置为 0, 0, 1 并旋转它。然后用它来设置你的飞机。
-
谢谢。奇迹般有效。您可以将其添加为答案,我会接受吗?
标签: android libgdx opengl-es-2.0