libgdx视口 - 为什么使用FitViewport时,触摸输入的x和y坐标不准确?

3
libgdx视图 - 为什么使用FitViewport时,触摸输入的x和y不准确?enter image description here

你是如何获取X和Y的? - Tenfour04
我使用InputAdapter的touchDown方法获取screenX和screenY,然后传递给Vector3的touchpoint.set(screenX, screenY, 0),最后使用camera.unproject(touchpoint)获取世界坐标。 - ronscript
1个回答

4
请使用viewport.unproject()代替camera.unproject(),这样可以考虑到FitViewport的裁剪。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接