1. In the demo the character can push dynamic objects
2. the character climbs stairs smoothly and realistically instead of appearing immediately at the next step
I found some code that completely fixes the stepping down stairs from here: http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=5684
I still had problems with climbing up stairs when the player moved onto the next step they would immediately appear at the next step instead of smoothly moving upwards. I tried to apply the from the stepDown function to the stepUp function but they are different beasts altogether. Without rewriting the whole thing from scratch I can't think of a way to fix the problems. When I set up my character controller I do this:
btTransform startTransform; startTransform.setIdentity (); startTransform.setOrigin (btVector3(0, 0, 0)); btConvexShape* capsule = new btCapsuleShape(width, height); m_ghostObject = new btPairCachingGhostObject(); m_ghostObject->setWorldTransform(startTransform); broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback()); m_ghostObject->setCollisionShape(capsule); m_ghostObject->setCollisionFlags(btCollisionObject::CF_CHARACTER_OBJECT); charCon = new btKinematicCharacterController (m_ghostObject, capsule, stepheight); charCon->setGravity(-dynamicsWorld->getGravity().getY()); dynamicsWorld->addCollisionObject(m_ghostObject, btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::AllFilter); dynamicsWorld->addAction(charCon);
If anyone notices anything wrong with my setup let me know. Also If anyone has any examples of other kinematic character controllers not necessarily bullet could they point in the right direction?