首页 > 解决方案 > Cocos Creator:将节点位置转换为 UILocation

问题描述

使用 cocos creator 打字稿,如何将节点位置转换为 ui 位置?

当你得到一个触摸事件时,我可以event.getUILocation()通过将它传递给PhysicsSystem2D.instance.testPoint(event.getUILocation()).

我想使用testPoint, 通过this.node.getWorldPosition()某种方式转换。

我试过camera.worldToScreen了,单位不对。

正确的方法是什么?

谢谢。

标签: cocoscreator

解决方案


推荐阅读