需要在点击时候判断是否点击到物理碰撞体,PhysicsManager 里的testPoint一直都是返回null不知道哪里出错了,大佬帮看看。
代码:
touchStart(event : cc.Event.EventTouch) {
let touchLoc = event.getLocation();
let result = cc.director.getPhysicsManager().testPoint(cc.p(touchLoc.x, touchLoc.y));
console.log('接触时碰撞结果为 :'+result);
if(result) {
return false;
}
return true;
}