# 使用触摸进行三维交互
本章节主要介绍,如何使用二维触摸组件,控制画面中三维/二维物体的移动
# 二维世界触摸控制
添加大小适配二维世界的透明触摸节点,并添加触摸事件绑定
const globalTouch = globalTouchTransform.entity.getComponent(engine.TouchInputComponent);
globalTouch.onTouchStart.add((sender: engine.TouchInputComponent, event: engine.TouchInputEvent) => {
//..
});
# 获取三维世界目标元素
const mainCamTransform = this.getChildByName(engine.game.activeScene.root.transform, 'Main Camera');
const mainCam = mainCamTransform.entity.getComponent(engine.Camera) as engine.Camera;
const stoneTransform = this.getChildByName(engine.game.activeScene.root.transform, 'stone_tallA');
# 三维目标元素坐标转化到齐次裁剪坐标
const stoneClipPos = mainCam.convertWorldPositionToClip(stoneTransform.worldPosition);