当场景中存在相机时,Touch的世界坐标会受到相机影响。
当相机位置处于(0,0)时或没有相机时,Touch.getLocation()得到的值就是世界坐标,
当存在相机和相机位置发生位移时,如在(100,100)的位置,此时Touch的世界坐标就受到影响。

let camera=cc.Camera.main;
let touchWorldPos=touch.getLocation().addSelf(camera.node.getPosition());
//或
let touchWorldPos=camera.getScreenToWorldPoint(touch.getLocation());

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-23
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
猜你喜欢
  • 2021-07-10
  • 2021-10-30
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案