Gravity/falling inactive in HelloCollision tutorial code? Why?

Hi all,

I’ve been enjoying trying out jmonkey using the beginner tutorials, but I’ve run into an issue with HelloCollision https://wiki.jmonkeyengine.org/jme3/beginner/hello_collision.html

Basically, gravity isn’t making me fall. The WASD/mouse movement is totally fine except for the Y axis. If I mouse up, I start floating, and if I jump, I float up forever. Also, not sure what’s supposed to happen if you step off the map, but that also doesn’t make me fall.

I’m using the sample code copy/pasted exactly. Can someone else run the code and tell me if it’s working right for you, please?

What development environment do you use?

It’s the dedicated jMonkeySDK IDE environment, linux version, open jdk 8

JME pre 3.2 uncomment the 2 lines

// pre jME3.2

and comment the lines they are meant to replace.

Oh, I’m sorry, should’ve put jmonkey version too. It says I’m running 3.2.1-stable-sdk3

I tried your suggestion just to be sure, but no, problem was still there running the deprecated lines instead

I just looked at the example code in the tutorial, and I noticed it doesn’t set the gravity on the BulletAppState itself, only the gravity for the player.

I haven’t used the bullet physics in a while so I don’t know for certain if it will help, but you could try adding this code and see if it fixes the problem.

  Vector3f worldGrav = new Vector3f(0, -1, 0); //might take a float if you're running 3.1
  bulletAppState.getPhysicsSpace().setGravity(worldGrav);

Hmm. Didn’t work either…

Thanks for the idea

I wish I knew for sure if this was some problem with my set up or with the tutorial code

All the other tutorials so far (I’m working on the Effects one now) run just fine, and the collision detection itself in HelloCollision still works. In fact, I’ve figured out that if I fly under the level map before I jump that I stop floating up when I hit my head on the bottom of the level haha

I ran the tutorial on win7 , jme3.2.1 and works fine as is.

Try reversing the gravity,

 player.setGravity(new Vector3f(0, 30f, 0));

See what happens.

Edit: Space bar spamming will make you fly higher and higher so I wonder if your having something crossed up with key events.

What does your bullet libraries show for versions?

So, since I saw mitm say that it was working on Windows, I’ve tried a few other environments:
linux/openjdk: doesn’t work
linux/oracle jdk: doesn’t work
windows10: works

is it possible that this is a bug in the linux version?

And I’ll try to find that info on the bullet libraries, but you’ll need to tell me how…

Bullet should be whatever the current defaults are? I only started using jmonkey within the last week

yes, under libraries. You will see bullet and bullet-native.

Edit: in an open project.

I see “jme3-bullet - jme3-bullet-3.2.1-stable.jar”
and “jme3-bullet-native - jme3-bullet-native-3.2.1-stable.jar”

Gravity was changed for 3.2+. Looks like someone with Linux experience will need to help. The usual route for this seems to be update drivers or change libraries and such but I wouldn’t know where to start and if that even would help.

I know 3.1 stable sdk works using the old system but there has to be a reason this is happening and a way to fix this.

Unless the bullet-native build has been updated to use OpenCL for the rigid body pipeline, I don’t see how drivers could be related.