一拖动组件就消失?

我想做一个能拖动的组件,但我touch事件一点击,组件就消失在画面,但我看log,x、y座标位置是有资料在异动的,想请问是那边问题导致的?

this.node.on(Node.EventType.TOUCH_MOVE, this.onTouchMoved, this);

onTouchMoved(event) {
let pos = event.getLocation();
pos = this.node.parent.getComponent(UITransform)
.convertToNodeSpaceAR(pos);
this.node.position = pos;
}

pos的类型是Vec2,convertToNodeSpaceAR传入的参数类型得是Vec3

应该是 getUILocation() 而不是 getLocation()

没错 已解决,感谢感谢