有一个场景是,当我子弹碰撞怪物时,我更改了怪物的碰撞分组,然后让怪物执行碰撞后的消失动画。在测试时发现,怪物已经更改了组,但是在怪物执行动画的时候,子弹依然可以打到怪物。这个应该怎么解决?
想要解决好,demo少不了
onCollisionEnter: function (other, self) {
self.node.cleanup();
this.game.bsonBulletskilled(self.node);
//加入不碰撞组,在动画结束后加入碰撞组
other.node.runAction(cc.sequence(cc.callFunc(function () {
other.node.group = "other";
}), cc.callFunc(function () {
other.node.getComponent(cc.Animation).playAdditive("smoke_dis");
})));
cc.log(other.node.group);
this.game.pricenum++;
},
是这样的。然后动画结束执行了改回分组函数。
但是即使这样,还是可以碰撞很多次。
收到,已验证确实有问题~~
请问 3 年过去了,这个问题有没有得到解决-.-
没有解决!!!我用的2.0.10版本,一样有这个问题