《cocos creator 踩坑日记》 碰撞不起效

 只要在onLoad()中 开启 才有效,在onEnable()或者start()都无效

要触发碰撞回调函数还需要把这个勾上

《cocos creator 踩坑日记》 碰撞不起效

 

原来的碰撞触发方法:

onCollisionEnter: function (other, self) ;

onCollisionStay: function (other, self) ;

onCollisionExit: function (other, self) ;

上面的三个方法好像失效了。碰撞后没打印出来东西

后续的碰撞方法:

 onBeginContact: function (contact, selfCollider, otherCollider) {

        console.log('有人碰到了玩家');

      },

      // 只在两个碰撞体结束接触时被调用一次

      onEndContact: function (contact, selfCollider, otherCollider) {

    },

      // 每次将要处理碰撞体接触逻辑时被调用

      onPreSolve: function (contact, selfCollider, otherCollider) {

      },

      // 每次处理完碰撞体接触逻辑时被调用

      onPostSolve: function (contact, selfCollider, otherCollider) {      

      }

 

相关文章:

  • 2021-05-12
  • 2021-08-15
  • 2022-12-23
  • 2021-04-13
  • 2022-12-23
  • 2021-05-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-28
  • 2021-10-29
  • 2021-06-03
  • 2021-05-31
  • 2021-09-11
  • 2021-12-22
相关资源
相似解决方案