Physics3DShape::initMesh 函数中 auto mesh = new btTriangleMesh(false); 这个mesh变量没有保存,内存泄露就是这里,这个mesh没有释放。
Physics3DShape::initHeightfield 里的_heightfieldData = new unsigned char;是同样的道理,但 _heightfieldData 是成员变量,析构函数中有delect。
此外 Physics3DComponent::setEnabled(bool b);函数,3.8.1版本中 bool oldBool = b; 应该是笔误,造成无法 执行 removePhysics3DObject操作,3.9版本中看到了修改bool oldBool = _enabled;
这里想提的是 compnonent 可以加入 group 和 mask,这个是bullet本身有的功能,稍微修改就可以,本人自己已经实验过,暂时没有出错,很好用的功能。
不知道后续版本中会如何加入 碰撞过滤 的功能。这里的建议仅供参考!!