Character control setUp to fix gravity for some computer environments


just to let know, not sure if someone have same issue. For example for me when i use JME tests character control, the character gravity direction is not going to floor but “side” like left or right, whatever.

On other computer with different OS etc etc. It works fine.

I managed to observe that for my own computer i need use characterControl.setUp(new Vector3f(0, 1, 0)); but setUp break on second computer because native library “dont have it” for some reason. I understand it use some openGL lib that can make difference based on computer/system

so i end up with follow code that work on both computers and fix my personal computer issue.
here is ugly fix:

try {
    characterControl.setUp(new Vector3f(0, 1, 0));
} catch (Throwable e) {

but anyway want to share what i observed. Im using stable version so idk if its already fixed in beta.

1 Like

Yeah, I had that problem a while ago running some Zelda project I found on the forums. I didn’t know how to solve it, but soon after I got that issue I got a new PC, which didn’t have the issue. :neutral_face:

Does it do the same thing with BetterCharacterControl?

1 Like

This is one piece of issue 910:
PhysicsCharacter incompatible between jme3-bullet and jme3-jbullet · Issue #910 · jMonkeyEngine/jmonkeyengine · GitHub


BetterCharacterControl dont seem to have this issue in my app somehow.

but when i run JME test with better character it go up instead down(because i think it should go down?)

Use a negative Y value for the gravity Vector3f. pspeed suggests a -20.0f.

There was a forum thread on another solution if that doesn’t work but I cant find it right now.

Search for, BetterCharacterControl, CharacterControl, gravity, tutorial. I don’t have the time until this afternoon.

Edit: Found the thread but it may not help as there was no follow up by original poster.

They reported different results with different OS so changing Bullet libraries is the only other thing that might help if setting gravity for the physics space itself doesn’t work. Otherwise it may be down to the issue posted by @sgold and still be broken for some it seems.