Kinematic Character Controllers


First experiments. Any help is welcome

A more advanced character controller
Kinematic character control with Bullet

Looks good.

Try testing things like:

  • pushing against corners
  • pushing against stacked vertically segmented wall, so you collide with several segments at once
  • pushing against downward slopes

can you provide scene to reproduce?


each segment is a rigid body:


i have a few question about your code ( i have not tested it yet)

why you use z-axis as up vector?

bulletController_ = new btKinematicCharacterController(ghostObject_, capsule, 0.3f, btVector3(0, 0, 1));

and later you use DOWN vector here

btTransform t;
t = bulletController_->getGhostObject()->getWorldTransform();
Vector3 newPos = ToVector3(t.getOrigin()) + Vector3::DOWN * height_ * 0.5f;

i would like to understand the mathematic behind it or kinematic …

from the youtube video it looks promising


It does not matter which vector I’m setting. Vertical direction is rewritted when bulletController_->setGravity(world->getGravity());


ok thanks,

when i try to run the code “I use clion with cmake” I got SIGSEGV during initialising the Application in

Game(Context* context) : Application(context)

exactly in the code in Urho3d Timer.cpp

String Time::GetTimeStamp()
     time_t sysTime;
     time(&sysTime); // here we got SIGSEGV
     const char* dateTime = ctime(&sysTime);
     return String(dateTime).Replaced("\n", "");

which get called when initialisng input and try to Log something

it seems theres some memory damage some where which i don’t know


Have you copied GameData folder to *.exe dir?

EDIT: and Data+CoreData


yes i done …
but as i said, it does reach the code which setup the game … it crash on constructor of Game object


I’m sorry, I do not have experience with “clion” (and do not even know what it is xD ) I tested this code with VS 2015 and recheck now with VS 2017


no problem … i will try to reconstruct the programm in another code example


it seems the issue with global variables and global.cpp
i habe removed global.h and global.cpp and used private variables in Game class and CharacterControl class then the example works.

again thanks for this great simple example