2d转3d方式
private _touchEnd(touch: EventTouch) {
const camera = this.camera3d.camera;
let rolePos = new Vec3();
let worldPos = this.roleNode.worldPosition;
camera.worldToScreen(rolePos, worldPos);
const touchPos = touch.getLocation();
console.log(`touchPos: x=${touchPos.x}, y=${touchPos.y}`);
//0。01为z轴;
const screenPos = new Vec3(touchPos.x, touchPos.y, 0.01);
camera.screenToWorld(rolePos, screenPos);
const uiTrans = this.roleNode.parent.getComponent(UITransform);
rolePos = uiTrans.convertToNodeSpaceAR(rolePos);
this.roleNode.setPosition(rolePos);
}