cocoscreator - Cocos Creator:将节点位置转换为 UILocation
问题描述
使用 cocos creator 打字稿,如何将节点位置转换为 ui 位置?
当你得到一个触摸事件时,我可以event.getUILocation()
通过将它传递给PhysicsSystem2D.instance.testPoint(event.getUILocation())
.
我想使用testPoint
, 通过this.node.getWorldPosition()
某种方式转换。
我试过camera.worldToScreen
了,单位不对。
正确的方法是什么?
谢谢。
解决方案
推荐阅读
- python - How to execute python file from other directory?
- excel - 将文件保存在超链接后面
- github - 如何在 Red Hat OpenShift 中配置 GitHub Webhook URL?
- docker - 将当前本地 ip 传递给 docker-compose 中的 dnsmasq 命令
- android - Android,Qt,如何启动“hello world”服务
- python - 按级别顺序打印树的内容,使用 eval 函数读取 python 中的输入树
- daml - 访问 DAML 模板中的变量,就像在对象中一样
- php - 如何将 ajax 数据存储在 php 变量中并重用它?
- java - 如何排列 Java GUI 按钮?
- javascript - 检查属性与检查函数的返回值的性能是什么?