Jump to content
  • Advertisement
Sign in to follow this  
ic0de

btKinematicCharacterController unrealistic climbing

This topic is 2028 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!