btKinematicCharacterController unrealistic climbing

Started by
0 comments, last by Krohm 11 years, 3 months ago
So I have a slightly modified btKinenematicCharacterController and I'm noticing two things about it that differ from the demo:

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?
Advertisement

[quote name='ic0de' timestamp='1356125802' post='5013253']
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.
[/quote]Like it's rising itself on its feet? I'm not sure how can you tell the difference at 60 fps.

I have been told the PhysX character controller is very good. I guess a day I'll register and take a look at it.

My best bet regarding your controller not pushing objects is that it

  1. Is not associated with a persistent btRigidBody OR
  2. it entered sleeping state (remember do disable it, collision objects are equivalent to static)

As a side note LN3 is redundant, as the identity transform has (0,0,0) translation component.

Previously "Krohm"

This topic is closed to new replies.

Advertisement