HelloCollision will need update for 3.2


#1

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
#2

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?


#3

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.


#4

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.


#5

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…


#6

The tutorial HelloCollision has some weird effects now.
https://jmonkeyengine.github.io/wiki/jme3/beginner/hello_collision.html

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.


#7

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.


#8

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?


#9

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


#10

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.


#11

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.


#12

Maybe I am using the wrong jars?

jme3-core-3.2.0-SNAPSHOT.jar
jme3desktop-3.2.0-SNAPSHOT.jar
jme3-lwjgl-3.2.0-SNAPSHOT.jar
jme3-jogg-3.2.0-SNAPSHOT.jar}
jme3-plugins-3.2.0-SNAPSHOT.jar
jme3-blender-3.2.0-SNAPSHOT.jar
jme3-terrain-3.2.0-SNAPSHOT.jar
jme3-effects-3.2.0-SNAPSHOT.jar
jme3-bullet-3.2.0-SNAPSHOT.jar
jme3-bullet-native-3.2.0-SNAPSHOT.jar
lwjgl-platform-2.9.3-natives-windows.jar
jutils-1.0.0.jar
jinput-2.0.5.jar
jinput-platform-2.0.5-natives-windows.jar
lwjgl-2.9.3.jar
gson-2.8.1.jar
j-ogg-all-1.0.0.jar


#13

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