I'm learning to use bullet and trying to implement an avatar using btKinematicCharacterController.
My avatar falls through the landscape and just keeps going
To debug it I turned off creation of the visible mesh and turned on debugDrawWorld() calls.
I can see the capsule is created and is passing through the static objects that make up the landscape.
You can see the capsule below the landscape: The capsule is rendered in red so I added a call to disable deactivation of the object.
This did not improve the result. Any other suggestions?
Is this class supposed to automatically handle collisions with static objects?
If not, are there any examples/documentation of how to do it yourself?
Is the capsule for the ghost object in the character demo the recommended way to use this code?
Should we replace the capsule with our own more complex shape (btBvhTriangleMeshShape in my case)?
Here's the initialization code for the avatar/character:
Code: Select all
btTransform startTransform;
startTransform.setIdentity();
startTransform.setOrigin( btVector3( 0.0f, 0.0f, 0.0f ) );
m_ghostObject = new btPairCachingGhostObject();
m_ghostObject->setWorldTransform( startTransform );
m_ghostObject->setActivationState( DISABLE_DEACTIVATION );
btVector3 worldMin( -1000, -200, -1000 );
btVector3 worldMax( 1000, 200, 1000 );
m_overlappingPairCache = new btAxisSweep3( worldMin, worldMax );
m_overlappingPairCache->getOverlappingPairCache()->setInternalGhostPairCallback( new btGhostPairCallback() );
btConvexShape* capsule = new btCapsuleShape( characterWidth, characterHeight );
m_ghostObject->setCollisionShape( capsule );
m_ghostObject->setCollisionFlags( btCollisionObject::CF_CHARACTER_OBJECT );
btScalar stepHeight = btScalar( 0.35f );
m_character = new btKinematicCharacterController( m_ghostObject, capsule, stepHeight );
m_character->setJumpSpeed( 10.0f );
m_character->setFallSpeed( 20.0f );
m_character->setMaxSlope( 1.5f );
m_character->setGravity( 1.0f );