Kinematic character controller

Post Reply
codeman_nz
Posts: 4
Joined: Thu Aug 25, 2016 3:50 am

Kinematic character controller

Post by codeman_nz »

Hi everyone,

I am tearing my hair out with the kinematic character controller. I managed to get it initialized and running but I can only get it to collide with static objects. How can I get it to collide with dynamic objects?

If the kinematic character controller is not the way to go then can someone point me to a working character controller for bullet.

Thanks.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Kinematic character controller

Post by benelot »

Hi codeman_nz,

Do you know about the older kinematic character controller? I never did anything with the controller, but I know that only recently there was a rewrite/update to the character controller which seems to mess up a lot of people's code. Try to get a version of it and check if it does collide with dynamic objects. If it does, we could find out why the never does not work anymore and then fix it in the new controller.
codeman_nz
Posts: 4
Joined: Thu Aug 25, 2016 3:50 am

Re: Kinematic character controller

Post by codeman_nz »

benelot wrote:Hi codeman_nz,

Do you know about the older kinematic character controller? I never did anything with the controller, but I know that only recently there was a rewrite/update to the character controller which seems to mess up a lot of people's code. Try to get a version of it and check if it does collide with dynamic objects. If it does, we could find out why the never does not work anymore and then fix it in the new controller.
Is there an example of how it is used? I downloaded the latest bullet and I can't see one.
benelot
Posts: 350
Joined: Sat Jul 04, 2015 10:33 am
Location: Bern, Switzerland
Contact:

Re: Kinematic character controller

Post by benelot »

Yes, unfortunately that one is not yet ported. It is in the old_demos branch here:
https://github.com/bulletphysics/bullet ... racterDemo

I will port it soon to the newest example framework, but I am not sure if it still works with the newest btKinematicCharacterController. If you are about to test it, you might be basically about to port it into a new example of the example browser. Just tell me if you want to port it, otherwise good luck with the example.
123iamking
Posts: 10
Joined: Wed Oct 11, 2017 4:45 am

Re: Kinematic character controller

Post by 123iamking »

It's been a year, I wonder if it works now. I see this test for the kinematic controller
For now only a simple test that it initializes correctly.
I try it anyway
I initialize the controller

Code: Select all

//Members
btRigidBody* m_pTommyRigid;
btCollisionShape* m_pTommyShape;

/*Controller for Tommy*/
btPairCachingGhostObject* ghostObject = new btPairCachingGhostObject();
m_pTommyController = new btKinematicCharacterController(ghostObject, static_cast<btCapsuleShape*>(m_pTommyShape), 1);
//Of course there is m_pTommyRigid, I've tried to convert m_pTommyRigid to btPairCachingGhostObject, but I can't, any idea...
In the update loop

Code: Select all

if (m_pTommyController)
   m_pTommyController->updateAction(m_dynamicsWorld, timeSinceLast);
I tried to move the character when click the mouse

Code: Select all

m_pTommyController->setWalkDirection(moveVec);
m_pTommyController->applyImpulse(moveVec);
But... Of course I failed, the code crash when this code is called

Code: Select all

if (m_pTommyController)
   m_pTommyController->updateAction(m_dynamicsWorld, timeSinceLast);
So... What's your solution for character controller?
If I just set a plain capsule shape for my character, then my character can't even walk, it just roll - like a soulless capsule.
Post Reply