【问题标题】:libgdx Viewports - Why when I use FitViewport the touch input x and y is not accurate?libgdx Viewports - 为什么当我使用 FitViewport 时,触摸输入 x 和 y 不准确?
【发布时间】:2016-07-06 14:27:33
【问题描述】:

libgdx Viewports - 为什么当我使用 FitViewport 时,触摸输入 x 和 y 不准确?

【问题讨论】:

  • 你是如何获得 X 和 Y 的?
  • 我使用InputAdapter touchDown获取screenX和screenY,然后传递给Vector3 touchpoint.set(screenX, screenY, 0)和camera.unproject(touchpoint)获取世界坐标。

标签: android libgdx 2d viewport


【解决方案1】:

使用viewport.unproject() 而不是camera.unproject(),以便考虑FitViewport 的裁剪。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-06-11
    • 1970-01-01
    • 1970-01-01
    • 2015-03-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多