Testbettercharactercontrol - the monkey character " gets stuck when Jumping on object"


When I ran testbettercharacterController which is included in jme3testbullet package, the monkey gets stuck on the box. So I’m trying to jump up on the box , so if I hold down “W” as in moce forward, the character is not falling down until I release “w”. Why is that

It’s like it has glue in the face :smile:

If you strapped a jetpack to your back and flew into a wall really hard, I suspect you wouldn’t fall either.

I didn’t know that it was an invisible jetpack. But this happens when I jump. So if I want to use this code in my game, how do I make him fall instead?

The invisible jet pack is because when you push “forward” on the keyboard, you are directly applying force… it’s not like someone walking who would only have force applied if their feet are on the ground. It’s like an invisible jet pack.

…maybe that gives you a hint at a solution? (ie: turn off the jetpack when the feet are not on the ground)

Okey now I’m following! Thanks for answering and great support! :smile:

Another way is to set the friction of the rigid body to 0. If you want to control the player movement even in the air is the easiest way to fix it (maybe not the best). You can find how to do it here.

Hi, thanks for helping out, I will try both ways!

Yeah I also had that problem, you can walk along walls with it.^^
You can also do bunny hopping or when walking over something you are thrown up in the air.

But: The BCC already has a isOnGround() method, shouldn’t the setWalkDirection take care of that?
Does setting friction to zero have any other side-effects, @NemesisMate ?

It depends on the game but generally, no, I don’t think so there is a problematic side-effect. You also could make some ray tests when applying forces and, if there is a wall, stop the force but It’s normally harder to implement as it depends on the collision shapes. The friction tweak is just fast and easy.