[SOLVED] Hello collision project - gravity problems


#1

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 ?


#2

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


#3

Linux Mint 18.3
I have imported bullet-native library.
I downloaded from src: https://github.com/jMonkeyEngine/sdk/releases/tag/v3.2.1-stable-sdk3
this is latest release.


#4

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)


#5

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.


#6

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…


#7

#8

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)


#9

Did you ever get the tutorial to work for you?


#10

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.


#11

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.


#12

@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?


#13

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.