2
votes

I wasn't sure if this was the correct forums to post this on; I was considering the Game Development site.

I'm developing a game in LibGDX (Java) and I've set up a btKinematicCharacterController to control the player. This handles the jumping, walking, and everything else.

However, I've come across a problem. Imagine that the character is standing on a slope -- even a very gradual one. The character will slowly slide down the slope, which is very annoying for the purpose of my game (and, I imagine, most.) This is because if a player wants to just stand on a slope, they can't.

I think this is happening because of the collision detection resolution. The player may very slightly fall through the floor, and since it's on a slope, would then be pushed out along the normal of the slope. This would mean, simply, they'd be pushed along slightly.

My actual player model is a capsule, and I use a ghost object for the btKinematicCharacterController.

So how can I make sure that my character doesn't slide down slopes? Of course, it needs to still have physics so that it can jump, and collide with other objects.

1

1 Answers

2
votes

One of the popular approach is to disable gravity when there are >=1 platforms under the character's foot.

It can be done by :-

Another approach is to hard code it (link to a short discussion - 2D Metroid related), but it is a hard work and heavily depend on the stage design.

This video may help. It is Unity, not related to Bullet, but seems applicable.

I am also very interested in this problem. Please don't accept if it doesn't solve.
To reader, if there are better answers, feel free to share.