OgreBullet Trimesh
Posted: Mon Nov 28, 2011 1:19 pm
I'm using Ogre and Bullet for a project and I currently have a first person camera set up with a Capsule Collision Shape. I've created a model of a cave (which will serve as the main part of the level) and imported it into my game. I'm now trying to create an OgreBulletCollisions::TriangleMeshCollisionShape of the cave.
The code I've got so far is this but it isn't working. It compiles but the Capsule shape passes straight through the cave shape. Also I have debug outlines on and there are none being drawn around the cave mesh.
Any suggestions are welcome.
It compiles but the Capsule shape passes straight through the cave shape. Also I have debug outlines on and there are none being drawn around the cave mesh
The code I've got so far is this but it isn't working. It compiles but the Capsule shape passes straight through the cave shape. Also I have debug outlines on and there are none being drawn around the cave mesh.
Code: Select all
Entity *cave = mSceneMgr->createEntitya("Cave", "pCube1.mesh");
SceneNode *caveNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
caveNode->setPosition(0, 10, 250);
caveNode->setScale(10, 10, 10);
caveNode->rotate(Quaternion(0.5, 0.5, -0.5, 0.5));
caveNode->attachObject(cave);
OgreBulletCollisions::StaticMeshToShapeConverter *smtsc = new OgreBulletCollisions::StaticMeshToShapeConverter();
smtsc->addEntity(cave);
OgreBulletCollisions::TriangleMeshCollisionShape *tri = smtsc->createTrimesh();
OgreBulletDynamics::RigidBody *caveBody = new OgreBulletDynamics::RigidBody("cave", mWorld);
caveBody->setStaticShape(tri, 0.1, 0.8);
mShapes.push_back(tri);
mBodies.push_back(caveBody);It compiles but the Capsule shape passes straight through the cave shape. Also I have debug outlines on and there are none being drawn around the cave mesh