I'm using Bullet and Ogre3d in a personnal project.
It works well with collision and some other stuffs. As the jump() function is not implemented yet for the kinematic character controller, I did it by myself. But when the character is in the air, its fallspeed is really slow, and it is the same for a box I put in the air to see how fast it fall.
Can someone help me ?
Here is some code, creation of the character :
Code: Select all
btTransform startTransform;
startTransform.setIdentity ();
startTransform.setOrigin (btVector3(0.0,100.0,0.0));
mPlayerGhost = new btPairCachingGhostObject();
mPlayerGhost->setWorldTransform(startTransform);
mPhyWorld->getBroadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
mPlayerShape = new btCapsuleShape(mPlayerEntity->getBoundingRadius()/4,mPlayerEntity->getBoundingRadius()/4);
mPlayerState = new BtOgre::RigidBodyState(mPlayerNode);
mPlayerGhost->setCollisionShape (mPlayerShape);
mPlayerGhost->setCollisionFlags (btCollisionObject::CF_CHARACTER_OBJECT);
btScalar stepHeight = btScalar(0.25);
mPlayerController = new btKinematicCharacterController (mPlayerGhost,mPlayerShape,stepHeight);
mPhyWorld->addCollisionObject(mPlayerGhost,btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::StaticFilter|btBroadphaseProxy::DefaultFilter);
mPhyWorld->addAction(mPlayerController);
Code: Select all
mBroadphase = new btAxisSweep3(btVector3(-10000,-10000,-10000), btVector3(10000,10000,10000), 1024);
mCollisionConfig = new btDefaultCollisionConfiguration();
mDispatcher = new btCollisionDispatcher(mCollisionConfig);
mSolver = new btSequentialImpulseConstraintSolver();
Globals::phyWorld = new btDiscreteDynamicsWorld(mDispatcher, mBroadphase, mSolver, mCollisionConfig);
Globals::phyWorld->setGravity(btVector3(0,-9.81,0));
Edit : it seems that the problem comes from the kinematic controller. I have a dynamic rigid body, a box, and its fall speed change with the gravity but not the character, that falls very slowly every time