I'm using a btCapsuleShape as the collision shape for my btKinematicCharacter. However, it's showing a odd behavior. Setting the capsule's correct height, it seems as though the collisions aren't correct:
The cube on the left is the one using the capsule shape (and yes it has the same height as the capsule), and it should be at the same height as the cube on the right...
And here's my code:
Code: Select all
btConvexShape *capsule = new btCapsuleShape(_model->getWidth()/2, _model->getHeight());
_ghostObject = new btPairCachingGhostObject();
_ghostObject->setWorldTransform(_transform);
arena->getAxisSweep()->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
_ghostObject->setCollisionShape (capsule);
_ghostObject->setCollisionFlags (btCollisionObject::CF_CHARACTER_OBJECT);
_kinematicCharacterController = new btKinematicCharacterController (_ghostObject, capsule, _stepHeight);
dynamicsWorld->addCollisionObject(_ghostObject, btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::StaticFilter|btBroadphaseProxy::DefaultFilter);
dynamicsWorld->addCharacter(_kinematicCharacterController);
Thanks!