I got some problems with the right mass and gravity. If I hit an object it flies away. Or if I jump (lift me a little up) I slide slowly down. So my question is how to set the values right?
I actually set the gravity to
Code: Select all
_dynamicsWorld->setGravity(btVector3(0,-99.8,0));The init code for the physics object:
Code: Select all
void BodyHandler::AddPhysicsBody(std::string strObjectID, bool bolStatic)
{
Ogre::SceneNode* ptrSceneNode = Scenegraph::GetSingleton().GetSceneNode(strObjectID);
Ogre::Entity* mEntity = Scenegraph::GetSingleton().GetEntity(strObjectID);
BtOgre::StaticMeshToShapeConverter converter(mEntity);
btCollisionShape* ptrShape;
btScalar mass;
/*
* Static RigidBody - doesn't move
*/
if(bolStatic)
{
ptrShape = converter.createSphere();
mass = 0;
}
/*
* Dynamic Body
*/
else
{
ptrShape = converter.createConvex();
mass = 10000;
}
btVector3 inertia;
ptrShape->calculateLocalInertia(mass, inertia);
BtOgre::RigidBodyState *state = new BtOgre::RigidBodyState(ptrSceneNode);
btRigidBody* mBody = new btRigidBody(mass, state, ptrShape, inertia);
mBody->setInvInertiaDiagLocal(btVector3(0,0,0));
mBody->updateInertiaTensor();
mapBodies[ ptrSceneNode->getName() ] = mBody;
PhysicsController::GetSingleton().GetPhysicsWorld()->addRigidBody(mBody);
}What do I wrong?