分类【游戏】下的文章

实际上2d游戏使用getUIPosition即可,无需屏幕转游戏坐标let node: Node = event.target let { x, y } = event.getLocation() let re = this.camera.screenToWorld(new Vec3(x, y, 0), node.getWorldPosition())...

Touch(屏幕坐标非游戏坐标)getLocation x轴为相对设计尺寸左下角距离getLocationInView x轴为相对视窗左侧距离,y轴为相对视窗中心距离getUILocation 游戏中相对左下角xy距离的坐标(若屏幕无缩放则与getLocation)无差异Node:getLocation为相对锚点坐标getWorldPosition为锚...

参考下面图片getComponet为获取右侧列表中的组件,getComponetInChildren为从左侧hero节点下,遍历所有子节点中的组件获取要查找的组件.componets可以和图三右侧对应,children可以和图左侧enemy1对应