`cc.Class({
extends: cc.Component,
// use this for initialization
onLoad: function () {
cc.director.getCollisionManager().enabled = true;
cc.director.getCollisionManager().enabledDebugDraw = true;
// cc.director.getCollisionManager().enabledDrawBoundingBox = true;
this.touchingNumber = 0;
},
onCollisionEnter: function (other) {
cc.log('1111111111')
this.node.color = cc.Color.RED;
this.touchingNumber ++;
},
onCollisionStay: function (other) {
// console.log('on collision stay');
},
onCollisionExit: function () {
this.touchingNumber --;
if (this.touchingNumber === 0) {
this.node.color = cc.Color.WHITE;
}
},
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});
`
能启动碰撞检测, 能开启碰撞检测框, 但是无法调用碰撞检测函数



