2
\$\begingroup\$

I've been experimenting with the btKinematicCharacterController. I've seen very old complaints that it has issues but I can't find anything recent stating that these issues remain (and nobody ever says what the issues were).

The problem I'm seeing is that the character is sliding down slopes at absolutely ANY gradient. It will only stand still on level ground. If I have a ramp with a very gentle gradient it will slide slowly. I've found posts asking about this on the Bullet forums but haven't found any solutions.

I've set the friction and rolling friction for both the ramp and character capsule to a very high value but it doesn't seem to impact the sliding. I'm sure there's something else I'm missing or is there something wrong with the controller's implementation of recoverFromPentrations (It seems to shift the object by the collision normal on the other surface which is necessary to avoid going through walls).

\$\endgroup\$
3
\$\begingroup\$

I'm guessing this is due to the collision resolution. Gravity pulls your character down and you start penetrating the slope. The collision is resolved along the slope normal, so you move out diagonally. Each frame the character moves down from gravity, and out slanted. You can imagine that since the resolution is slanted and gravity is downward, over time you will be pushed down the slope slowly. This is not dependent on friction.

To avoid this, don't apply gravity to the player unless he is in a non-grounded "state". This will require additional logic code.

Character controllers in physics engines can be hard.

I've also seen this problem fixed by raycasting downwards from the player during the grounded "state". Then you can always set the player's height to by standing right on the ground level. The downside to this approach is that you must code additional logic for prevent the player from walk up or down very steep ledges or cliffs. Heightmaps can make this easy, as you can just index into the heightmap array and retrieve the height at the location of the player.

\$\endgroup\$
  • \$\begingroup\$ This seems most likely. I was hoping all outstanding issues with this controller were fixed but I guess that's not the case. \$\endgroup\$ – luminus Dec 17 '13 at 1:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.