【发布时间】:2018-06-13 11:39:02
【问题描述】:
当我用鼠标拖动一个对象时,我试图阻止它穿过另一个对象。碰撞检测正在工作,我只需要防止该形状被拖过另一个形状。
setForCollision: function(symbol){
let cube = new THREE.Box3().setFromObject(this.centerCube[1]);//shape is fixed in place
let cube1 = new THREE.Box3().setFromObject(symbol);//dragging with mouse
if(cube1.isIntersectionBox(cube)){
console.log(shapes touched);
//I tried repositioning. It repositions it but doesn't really stop me from dragging it. Any suggestions?
symbol.position.set(0,0,0);
}
【问题讨论】:
标签: three.js collision-detection