Heres my code that loads it, I just modified the Bullet/Irrlicht tutorial so it's probably wrong
Code: Select all
void createMaze(const btVector3& position, const vector3df& scale, float mass)
{
IMesh* maze = game.getDevice()->getSceneManager()->getMesh("maze.obj");
IMeshSceneNode* node = game.getDevice()->getSceneManager()->addMeshSceneNode(maze);
node->setScale(irr::core::vector3df(0.2f, 0.2f, 0.2f));
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMaterialTexture(0, game.getDevice()->getVideoDriver()->getTexture("cube.jpg"));
btTransform transform;
transform.setIdentity();
transform.setOrigin(position);
btDefaultMotionState* motionState = new btDefaultMotionState(transform);
btVector3 halfExtents(scale.X * 0.5f, scale.Y * 0.5f, scale.Z * 0.5f);
btCollisionShape* shape = new btBoxShape(halfExtents);
btVector3 localInertia;
shape->calculateLocalInertia(mass, localInertia);
btRigidBody* rigidBody = new btRigidBody(mass, motionState, shape, localInertia);
PhysicsEntity* physicsEntity = new PhysicsEntity(node);
physicsEntity->setRigidBody(rigidBody);
world->addRigidBody(rigidBody);
}