问题描述
我对反应物理学的凸网格形状有疑问。发生冲突时,断言maxDotProduct> = decimal(0.0)失败。
reactphysics3d::Transform TempTransform(DFEPhysicsTransform::DFETransformToRPT(*LevelMeshes[i]->MeshTransform));
reactphysics3d::PolygonVertexArray::PolygonFace* polygonFaces = new reactphysics3d::PolygonVertexArray::PolygonFace[TempPhysicsMesh->FaceSizes.size()];
reactphysics3d::PolygonVertexArray::PolygonFace* face = polygonFaces;
// FaceSizes.size() is how many non-triangulated faces the mesh contains.
unsigned int BaseCounter = 0;
for (int i = 0; i < TempPhysicsMesh->FaceSizes.size(); i++)
{
face->indexBase = BaseCounter;
face->nbVertices = TempPhysicsMesh->FaceSizes[i]; // FaceSizes stores how many vertices there are per face,so that is what we set nbVertices to.
BaseCounter += TempPhysicsMesh->FaceSizes[i]; // Each index describes on vertex,so we increase the index base by the amount of vertices in this face.
face++;
}
// FaceVertices contains the vertices of the mesh in float form,:. sizeof(float) * 3.
// FaceIndices contains the index data directly loaded from a wavefront .obj file,with not triangulation.
// GetVerticesCount(),get the amount of whole vertices the mesh has. As in a vec3.
// SetupPhysicsMesh is my own function,which creates the convex mesh shape,using createConvexMeshShape.
reactphysics3d::PolygonVertexArray* polygonVertexArray = new reactphysics3d::PolygonVertexArray(TempPhysicsMesh->GetVerticesCount(),&(TempPhysicsMesh->FaceVertices[0]),3* sizeof(float),&(TempPhysicsMesh->FaceIndices[0]),sizeof(unsigned int),TempPhysicsMesh->FaceSizes.size(),polygonFaces,reactphysics3d::PolygonVertexArray::VertexDataType::VERTEX_FLOAT_TYPE,reactphysics3d::PolygonVertexArray::IndexDataType::INDEX_INTEGER_TYPE);
reactphysics3d::PolyhedronMesh* polyhedronMesh = SystemGlobalVars->GlobalPhysicsCommon->createPolyhedronMesh(polygonVertexArray);
TempPhysicsMesh->SetupPhysicsMesh(TempTransform,RPCS_ConvexMeshShape,DFECollisionShapeParams::SetConvexMeshShapeData(polyhedronMesh,DFEPhysicsTransform::GlmVec3ToVector3(std::get<glm::vec3>(ConvU::DecodeVector(6,3,TempEntityData[j].second)))),TempDataItems[3].DecodeInt(),DFEPOCM_ALL,SystemGlobalVars->GlobalPhysicsWorld,SystemGlobalVars->GlobalPhysicsCommon);
感谢您的帮助。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)