This is a Bullet port of my ODE Character Controller, with some additional improvements made possible by Bullet’s awesomeness. It is aimed to replace the Bullet’s default KCC in Panda, because that code has lots of missing features and some bugs. Hopefully this one will be better .
You have to use a new development build of Panda and even there collision detection might not work. This is a problem with Bullet and enn0x is looking into it.
- Walking with penetration prevention
- Jumping with active and passive jump limiter. Active means limiting the max jump height based on the distance to the “ceiling”. Passive means falling automatically when a “ceiling” is hit.
- Crouching with stand up limiter which prevents the character from standing up if inside a tunnel or other limited space
- Slope limiter of arbitrary maximum slope values which may or may not affect the movement speed on slopes smaller than maximum
- Stepping, supports walking steps up and down (prevents “floating” effect)
- Flying support for no-clip, ladders, swimming or simply flying
- Simplified state system. Makes double/multiple jumps impossible by default (and you can easily change that if you want to)
- Callbacks for landing and standing up from crouch
The controller is composed of a levitating capsule (allowing stepping), a kinematic body and numerous raycasts accounting for levitation and spacial awareness.
The code is documented, so take a look into kcc.py. Note it is not integrated yet and doesn’t inherit from Node.
If you want to parent anything to the controller, you will have to use the movementParent node. It is now exposed.
demo.py is obviously the demo and mouseLook.py is the custom mouselook code used for TPP camera in the demo. I’m not sure if the demo code will work correctly on Windows because of the differences in mouse support, so let me know if it doesn’t. If you end up with the camera under the map, don’t worry this is not a bug, it’s just an orbit code, not real TPP – just move the mouse until correct orientation is restored.
The jump height is deliberately insane in order to better visualize the active jump limiter.
- WASD – as usual
- space – jump
- c – crouch
- shift – run
- control – toggle flight
- r, f – fly up, down
And finally, you can get it here:
Enjoy and please give feedback