I have a problem mentioned in topic. I just can’t jump when the ground is not exactly flat. I checked that the isOnGround returns false when my character is not on the flat terrain. If you look at the picture attached you can see that in ‘second position’ the slope is hardly spottable but I got isOnGround == false there.
I’ve had the same issue with it. Honestly it’s not the greatest control, I think it’s still being worked on, but I’ve been sticking with the old CharacterControl. There are too many bugs with the new one.
Theres lots of problems with both but I guess more with the old one. Plus the new one isn’t a “black box” and you can easily extend it or change its behavior. Seems like noone cared enough to resolve the issues they have and contribute changes though.
The new charactercontrol has also the problem that is you keep jumping all the time (actually if you jump on the frame where you hit the ground) you’ll jump very high.
But the charactercontrol has also problems. For exemple, if you walk on a thin ground (like a plank. Doesn’t work with a real plan/single layer) you’ll warp constantly (small warp down). This is because of the stepheight which try to move your character bottom as it detects something a bit under it and doesn’t consider the fact that you are actually on the ground (i think).
You also have some problem when the head of the charactercontrol hit a wall which is non vertical (an inverted slop) (you’ll go through the floor).
On the opposite, the bettercharactercontrol doesn’t have a “stepheight” thing, so you’ll keep fying all the time on a non-flat ground. And if you keep walking to a wall while you jump, you’ll get stuck on it.
Both has problems. My main problem is the fact that the “charactercontrol” class is now deprecated, which is a non-sense : even if the bettercharactercontrol was flawless, this is still 2 different approach (kinematic vs physic), non of them is, in essence, “better” - they are just different.
EDIT : and the charactercontrol is NOT a blackbox, i already made some change to be able to change the gravity (but only with the 6 “standard” directions). The fact is, there is a lot of “complex” thing in the CC, but they all have a reason to be there. For exemple the “avoid bounce on a corner” is something that need to be done as a special case, you cannot include this case in something more general. Same happen for the stepheight.
I thought about looking in the code of the controller in quake 3 (open arena), but i didn’t get the energy and the envy to do it.
The bullet Character uses a lot of resources, doesn’t apply forces on its surroundings and brings its own irrational fall physics (as opposed to being kinematic which it is not). Thats the main issues the BetterCharacter tries to avoid. The issues it has with jumping could probably be avoided by doing the same dampening it does for sideway forces for upwards forces while its on the ground. The on the ground check could be improved by extending the length of the ray it uses for checking plus removing the ray check when a jump has been initiated. Also always check if you didn’t create a 1,80m high person that weighs 1 kilo or so.
It should also be noted in its defence, that it is essentially a collection of convenience methods, and uses all built-in jme functions to become what it is. Every “pre-built” situation like this is not going to fit into every possibility you can throw at it, and inevitably you’re going to have to get your hands dirty and situate it to your requirements.
Lets not forget that game-coding is essentially mathematics all over, and it has a lot of head-scratchers along the way! To quote myself, as I tell my wife once in a while, “if it was easy, it would be boring.”
actually i progressed on that topic and i have a more complex picture which show what should be done on the charactercontrol, but i don’t think you want to implement it anyway.
What you describe in the video is exactly the momentum that the bettercharactercontrol introduce, on purpose. The fact that you can push the bettercharactercontrol (with an explosion for exemple) means a lot of things, and these things include the fact that you “jump” when you arrive at the top of a hill.
@jayfella: I’ve tried increasing the gravity but it makes the falling speed not adequate to walking.(looks weird)
@bubuche: I saw your class and it looks like a good approach with that “applyVerticalRecoveryAndMagnet” method. I’ll try to analyze it further. For now it looks weird when I try to fall from a cliff for e.g but much thanks anyway.
Sometimes I feel like want to ‘have my cake and eat it too’ :).