【发布时间】:2014-08-04 22:02:54
【问题描述】:
所以我有这行代码:
new btBvhTriangleMeshShape(meshInterface, true);
这会导致我的程序崩溃。显然,函数内部的某处有一个 assert(numIndices>0) 行,这导致了崩溃。
如果我在行尾再添加一个false 参数,它看起来像:
new btBvhTriangleMeshShape(meshInterface, true, false);
我告诉它不要生成包围体数据,它继续正常(没有崩溃)。所以我的问题是:为什么当我在 meshInterface 中明确有索引时,它会崩溃并说我没有索引。
附加信息:
meshInterface 是这样创建的:
btTriangleMesh *meshInterface = new btTriangleMesh();
for(uint i = 0; i < terrainMesh.position.size(); i++) {
//don't remove duplicate vertex because there won't ever be any
meshInterface->findOrAddVertex(toBt(terrainMesh.position[i]), false);
}
for(uint i = 0; i < terrainMesh.index.size(); i++) {
meshInterface->addIndex(terrainMesh.index[i]);
}
我已经在另一个对象中设置了我的数据,我只是将它加载到项目符号设置中。
在这里您可以看到我的meshInterface 中有明显有效的数据。网格是一个平面。
【问题讨论】: