HelloCollision will need update for 3.2


The Hello Collision tutorial in the beginner tutorials will soon need updating for JME 3.2 because it uses 2 deprecated methods (jump() and setGravity(float) in PhysicsCharacter).

Changes since 2014

I saw those but what about setUp(Vecotr3f) which was setUpAxis(int) ?

It works like so now, player.setUp(Vector3f.UNIT_Y) correct?

Why no getUp() when there is getUpAxis() ?

It looks like, player.setGravity(30.0f) is now player.setGravity(new Vector3f(0.0f, 30.0f, 0.0f)) correct?

Jump works like this now, player.jump(Vector3f.UNIT_Y), correct?

Also, tutorials update on stable releases, so this is an Alpha release, when is stable to be expected?


Is anyone going through tests to update?

I updated most of mine to java 1.8 ver 3.1 stable but the engine is stuck at 1.7.

Edit: The wiki relies on Test projects.


The original physics character isn’t really “deprecated” in the actual sense of the word. Its part of bullet and we can’t really deprecate or remove it ourselves. It was marked ad deprecated to point people at the better and more flexible option of the BCC.


Erm. I’m being a bit cheeky and pre-emptive here, but is it possible we could put these hello examples in the jmonkey official gists? It would allow edits to be tracked and all that, but also downloading them and integrating them will be just a get request away…


The tutorial HelloCollision has some weird effects now.

Setting player.setGravity(new Vector3f(0.0f, 30.0f, 0.0f)) results in the camera slowly floating up into infinity.

Setting player.jump(Vector3f.UNIT_Y); results in nothing happening.

So many jars scattered all over the place I must be using the wrong ones.


There is a jme3-examples subproject in the Engine repository on GitHub. The jme3test.helloworld package in that project contains example apps similar to those in the Wiki (including HelloCollision.java). However the wiki and jme3-examples are a bit out of synch.


They are identicle files. The wiki uses the jme3-example files for tutorials.

I ran it both ways with 3.2-6418 and setGravity(30) and setGravity(new Vector3f(0.0f, 30.0f, 0.0f)).
Both do the same thing, character floats away.

If I set it to -30, it stays on ground. player.setGravity(new Vector3f(0,-30,0));

But then jump doesn’t work unless I do something like this player.jump(new Vector3f(0,10,0));.

Is the intended use?


Heh, can still spam the jump trigger and continually go higher but a side effect is now gravity doesn’t drag you down hillside.

Edit: I know you have to check onGround


While similar and doubtless based on the same source, the files have diverged and are not identical. For instance, in HelloCollision’s onAction() the Wiki has:

public void onAction(String binding, boolean isPressed, float tpf) {
    if (binding.equals("Left")) {
      left = isPressed;
    } else if (binding.equals("Right")) {
      right= isPressed;

whereas the v3.1 branch of the Engine has:

  public void onAction(String binding, boolean value, float tpf) {
    if (binding.equals("Left")) {
      if (value) { left = true; } else { left = false; }
    } else if (binding.equals("Right")) {
      if (value) { right = true; } else { right = false; }

It looks like someone has been improving the code in the WIki without updating the Engine repo.


I have tested both versions in my test folder without realizing they were slightly different.

They both require the exact same use of the new methods where you set gravity as a negative Vector3f and now set jump as a positive Vector3f.

I can only conclude that is the intended use since no one has said different.

Edit: As mentioned also, gravity no longer pulls a character down a slope in town.zip as before so some other things must need tweaking or I am using this all wrong now.


Maybe I am using the wrong jars?



Hah. Yeah. I filtered everything out with the word test in it. I can see them now :stuck_out_tongue: