btKinematicCharacterController and stairs

monah
Posts: 8
Joined: Thu Nov 19, 2009 1:05 pm

btKinematicCharacterController and stairs

Post by monah »

I use btKinematicCharacterController with the patch http://code.google.com/p/bullet/issues/ ... Controller, charactercontroller does not want to climb the stairs. Or rises, but only on low stairs. How to solve this problem?
This is my code create CharacterController:

Code: Select all

	btTransform startTransform;
	startTransform.setIdentity();
	startTransform.setOrigin(btVector3(-102.162f, 104.0f, 317.383862f));
	mGhostObject = new btPairCachingGhostObject();
	mGhostObject->setWorldTransform(startTransform);
	Application::getInstancePtr()->getBpInterface()->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
	btScalar characterHeight = 1.5f;
	btScalar characterWidth = 0.5f;
	btConvexShape* capsule = new btCapsuleShape(characterWidth, characterHeight);
	mGhostObject->setCollisionShape(capsule);
	mGhostObject->setCollisionFlags(btCollisionObject::CF_CHARACTER_OBJECT);
	btScalar stepHeight = btScalar(0.35);
	mCharacter = new btKinematicCharacterController(mGhostObject, capsule, stepHeight);
	Application::getInstancePtr()->getBulletWorld()->addCollisionObject(mGhostObject, btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::StaticFilter | btBroadphaseProxy::DefaultFilter);
	Application::getInstancePtr()->getBulletWorld()->addAction(mCharacter);
SteveSegreto
Posts: 32
Joined: Sun Sep 12, 2010 10:25 am

Re: btKinematicCharacterController and stairs

Post by SteveSegreto »

Hello!

I just recently started using the same patch as you for the btKinematicCharacterController. I encountered the same issue and after quite a bit of experimentation I was able to get the capsule to climb stairs by enlarging the width of the capsule (the ghost object).