没有使用物理的碰撞检测
onTouchStart(event: EventTouch) {
let screenPoint = event.getLocation()
const outRay = new ray();
this.cameraCom.screenPointToRay(screenPoint.x, screenPoint.y, outRay);
// (x-x0)/a=(y-y0)/b=(z-z0)/c
// x = x0 + (y - y0) * a / b
// z = z0 + (y - y0) * c / b
let x = outRay.o.x + (0 - outRay.o.y) / outRay.d.y * outRay.d.x
let z = outRay.o.z + (0 - outRay.o.y) / outRay.d.y * outRay.d.z
this.cube.setPosition(x, 0, z)
}
demo translate.rar (6.1 KB) Creator 3D v1.1.0