I'm attempting to create a btBvhTriangleMeshShape out of a large mesh in my application and use it as a Rigid Body. This Rigid Body will make up the 'ground plane' which is static and never moves. The problem is everything falls straight through like it's not even there. Here's the current source:
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);
PH->CreateRigidBody() is just a helper function to quickly create rigid bodies, I know this function works properly since other objects use it and collide just fine.
Any insight into the issue here would be greatly appreciated. Thank you all very much for your time.
EDIT: After hooking up the debug drawer here is what it displays (this is a shot from under the mesh): And for clarification here is an above shot:
I don't know if it's an issue with the mesh itself or with the code that iterates through the vertices to create the physics mesh