Code: Select all
btTriangleMesh* tMesh = new btTriangleMesh();
irr::scene::IMeshBuffer* MB = WorldNode1->getMesh()->getMeshBuffer(1);
irr::video::S3DVertex* Vertices = (irr::video::S3DVertex*)MB->getVertices();
irr::u16* Indices = MB->getIndices();
for (irr::u32 i = 0; i < MB->getIndexCount(); i+=3)
{
irr::core::vector3df Tri1Pos = Vertices[Indices[i]].Pos;
irr::core::vector3df Tri2Pos = Vertices[Indices[i+1]].Pos;
irr::core::vector3df Tri3Pos = Vertices[Indices[i+2]].Pos;
tMesh->addTriangle(btVector3(Tri1Pos.X, Tri1Pos.Y, Tri1Pos.Z), btVector3(Tri2Pos.X, Tri2Pos.Y, Tri2Pos.Z), btVector3(Tri3Pos.X, Tri3Pos.Y, Tri3Pos.Z));
}
btCollisionShape* groundShape = new btBvhTriangleMeshShape(tMesh, false);
btDefaultMotionState* groundMotionState = new btDefaultMotionState(btTransform(btQuaternion(0, 0, 0, 1), btVector3(0, -1, 0)));
PH->CreateRigidBody(0, groundMotionState, groundShape);
Any insight into the issue here would be greatly appreciated. Thank you all very much for your time.