cc,NodePool回收碰撞组件的节点 再次取出不生效

  • Creator 版本:2.4.3

  • 目标平台: 谷歌浏览器

  • 重现方式:碰撞完以后回收 再碰撞

  • 首个报错: 无

  • 之前哪个版本是正常的:

  • 手机型号:

  • 手机浏览器:

  • 编辑器操作系统:

  • 重现概率:百分百

Synthesis.zip (24.0 KB) Demo 让两个球碰撞 然后再点击一下 第三个球 会穿过下面地板

@panda @jare 引擎组的大佬可以帮我看一下嘛

不只是nodePool 自己写的回收后 再取出也不管用

引擎可不背这个锅哦

createFruits(type: FruitType, position) {

        let fruits = null

        if (this.nodePool.size() > 0) {

            fruits = this.nodePool.get()

        } else {

            fruits = cc.instantiate(this.cloneFruits)

        }

        this.node.addChild(fruits)

        fruits.position = position

        fruits.getComponent(Fruits).fruitsType = type

        **fruits.getComponent(cc.PhysicsCircleCollider).apply()**

        cc.log("生成的是", fruits)

        return fruits

    }
  • apply 应用当前 collider 中的修改,调用此函数会重新生成内部 box2d 的夹具。
    遇到问题了先查查文档看有没有忽略的地方。
    另外,你这个代码…嗯,加油~!

感谢,一直以为是刚体出了问题,但是为什么要重新重新生成内部 box2d 的夹具呢?

该主题在最后一个回复创建后14天后自动关闭。不再允许新的回复。