Cocos Creator 屏幕触摸坐标转换到本地坐标 - Camera
让物体跟随触摸点
touchMove(e:cc.Event.EventTouch){
//用位移偏差来改节点位置——遇到父节点或者摄像机有缩放就不行了
// this.node.x += e.getDeltaX();
// this.node.y += e.getDeltaY();
//获取触摸点的坐标
let pos = e.getLocation()
//用摄像机做转换,将触摸点转换到游戏中的世界坐标
let out = cc.v2();
this.stageCam.getScreenToWorldPoint(pos, out);
//从世界坐标,获取某个节点中的本地坐标
let localPos = this.node.parent.convertToNodeSpaceAR(out)
//设置
this.node.setPosition(localPos);
}