I am using Ogre 1.9 with bullet physics, 2.8.
I am trying to set up a first person camera that is at the same time collision aware (so that it cannot pass through walls, etc).
The problem is that I don't know what is a simple way of doing it.
After setting a the ground, I am using this for setting a camera rigid body, and attaching it to the camera node:
Code: Select all
btCollisionShape *cameraBox = new btBoxShape(btVector3(13.0f, 12.0f, 13.0f));
this->physicsEngine->getCollisionShapes().push_back(cameraBox);
btTransform startTransform;
startTransform.setIdentity();
btScalar mass = 1.0;
btVector3 localInertia(0,0,0);
cameraBox->calculateLocalInertia(mass, localInertia);
startTransform.setOrigin(btVector3(0.0f, 19, 15.0f));
btDefaultMotionState *myMotionState = new btDefaultMotionState(startTransform);
btRigidBody::btRigidBodyConstructionInfo rbInfo(mass, myMotionState, cameraBox, localInertia);
btRigidBody *body = new btRigidBody(rbInfo);
body->setRestitution(1);
body->setFriction(100.0f);
body->setUserPointer((void *)this->mCameraNode);
physicsEngine->getDynamicsWorld()->addRigidBody(body);
physicsEngine->trackRigidBodyWithName(body, std::string("cameraBody"));Code: Select all
bool Level2::mouseMoved( const OIS::MouseEvent &arg ){
}Does anyone know how to approach this? I just need some general guidelines, about how to figure out the orientation of the camera node, etc.