Jump to content

  • Log In with Google      Sign In   
  • Create Account


btKinematicCharacterController unrealistic climbing


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 ic0de   Members   -  Reputation: 808

Like
0Likes
Like

Posted 21 December 2012 - 03:36 PM

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?

you know you program too much when you start ending sentences with semicolons;


Sponsor:

#2 Krohm   Crossbones+   -  Reputation: 2963

Like
0Likes
Like

Posted 27 December 2012 - 03:51 AM

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.

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS