problem with btCapsuleShape

haba
Posts: 21
Joined: Sun Oct 12, 2008 3:38 pm

problem with btCapsuleShape

Post by haba »

Hi,

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:

Image
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);
Any ideas?


Thanks!
mickey
Posts: 107
Joined: Fri Sep 19, 2008 6:08 pm

Re: problem with btCapsuleShape

Post by mickey »

Hi Haba

Couldn't see your image.