[SOLVED] Hello collision project - gravity problems

Hello, I’m have problem with gravity. My character when jumps, he starts flying towards heaven.
I even copy paste code from this tutorial and it happens also.
https://wiki.jmonkeyengine.org/jme3/beginner/hello_collision.html

Is this issue is known for you guys ?

What operating system are you using? Are you using bullet native? Are you on the master branch or release?

1 Like

Linux Mint 18.3
I have imported bullet-native library.
I downloaded from src: Release v3.2.1-stable-sdk3: Fixes #57, Fixes #108 - Upgrading an existing installation should be … · jMonkeyEngine/sdk · GitHub
this is latest release.

I have the same issue (v3.2.1-stable-sdk3 on Linux (Ubuntu)). I have been googling it for a while, but cannot find any solution. It looks like the setGravity(Vector3f) in PhysicsCharacter does not do anything.
When the player (CharacterControl) jumps, he starts floating to heaven (as OP nicely put it). If I aim down and press up (W) I can go down again (slowly). As soon as the player collides with another object, the upward motion (floating) stops.
Anybody a solution / hint?

Edit: sorry for the bump, but problem still exists (afaik)

I’ve experienced this issue before, I think you are supposed to put the setGravity after you attach the CharacterControl is added to the spatial or when it’s added to the rootNode. If it’s completly unrelated, then ignore me.

Ignoring would not be very polite, but I think it’s unrelated. I took the code from the beginner tutorial ‘Hello Collision’, and moving the call to setGravity() after adding the player to the physicsSpace doesn’t help…

https://github.com/jMonkeyEngine/jmonkeyengine/issues/910

maybe could be worth create new character control using basic physics methods - that works for everyone (because as i know this controls currently have own methods in native-bullet and jbullet, right?).

CharacterControl was working best for me on windows/linux, but seems there are more issues even with workarround about gravity.

for me it was

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

if it dont help you, then idk. (try required to have both linux/windows working)

Did you ever get the tutorial to work for you?

No, the tutorial (when I copy-paste the code) doesn’t work. I keep flying after jumping (I never go down). It’s a nice zen-like experience, but not helpful in a game-setting.
AFAIK it’s only a problem in Linux in some environments.

1 Like

Try removing the jme3-bullet and jme3-bullet-native libraries from your classpath and adding the jme3-jbullet library.

If you’re using the IDE, you’d do this by right-clicking on the project and selecting “Properties”, “Libraries” (under “Categories”) and using the “Remove” and “Add library…” buttons.

1 Like

@sgold Thanks, that did the trick (after taking the example code and choosing the < jME3.2 version). But I understood from this forum (example) that the jbullet lib is being deprecated, in favor of the native bullet lib. Won’t this be a problem?

1 Like

jme3-jbullet hasn’t been officially deprecated. It’s merely difficult to support because the source code is missing from the repository.

If you’d like help getting HelloCollision to work with jme3-bullet or Minie, just ask.