I was trying to move and rotate the Oto mesh(that came with jMonkeyEngine) and got a error.
[java]java.lang.NullPointerException
at Main.robotmovetest$1.onAnalog(robotmovetest.java:44)
at com.jme3.input.InputManager.invokeAnalogs(InputManager.java:245)
at com.jme3.input.InputManager.invokeUpdateActions(InputManager.java:215)
at com.jme3.input.InputManager.update(InputManager.java:882)
at com.jme3.app.Application.update(Application.java:604)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:231)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:185)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:228)
at java.lang.Thread.run(Thread.java:722)[/java]
Sorry, I didnāt understand what you said.
I checked, line 16 is like it is in the Input tutorial, line 19 is like it is in the Animation tutorial(I actually checked and changed it to ā¦robot = (Node) assetManager⦠and imported com.jme3.scene.Node, didnāt help the problem). Iām not using the SDK, Iām using Eclipse and the Nightly builds.
is local in scope to simpleInitApp. Trying to reference robot in any other method is going to produce a NullPointerException, because your not setting the global field⦠youāre declaring a local variable with the same name.
Oh, I understand now. The robot mesh is only defined in the simpleInitApp, and the analogListener code doesnāt see it.
Thanks t0neg0d, youāve been really helpful.
Also, be nice yang, this is a public forum.
@MasterEric said:Also, be nice yang, this is a public forum.
He didn't say anything wrong. You should in fact learn java before learning jME.
The content of this post is meant to be read as a straight information or question without an implicit dismissive stance or interest in having the other party feel offended unless there's emotes that hint otherwise or there's an increased use of exclamation marks and all-capital words.
It was an easily over-lookable mistake.
Anyway, Iām trying to figure out how to load the model and still use it in the other methods, and canāt do it.
Iāve tried taking it out of the method(gives a nullpointerexception at the app.start(); line), putting it in its own method(still gives a nullpointerexception at the analogListener method). Nothing works.
Is there something Iām missing?
Declaring it outside the method then specifying it inside simpleInitApp seems like it would work, but Node gives me an error. I think you have the gist of what I need to do though.
Do I import com.jme3.scene.Node(which gives an error for the file path in the assetManager bit) or com.bulletphysics.collision.broadphase.Dbvt.Node(which gives an error at the file path and attaching to rootNode and scaling).
You can ignore the node part and just do it like you were before with Spatial. Im not sure why you would get a file path error now if it worked before, unless you changed something else. Perhaps post the stack trace output. Also almost 100% of the time you would want com.jme3.scene.Node fyi
Yes, the Dbvt thing is something you should not play with (except if you want to look into the working of the physics engineā¦). Stick to the com.jme3.scene.Node, as told by @wezrule.
But you can also use a spatial, as you did previously.
The only difference is you wonāt be able to get children of your model so easily. But you donāt seem to need itā¦
Edit : Sorry, reading the Wezrule post again, I see I donāt add much more.
I think there is no stack trace, it should not even compile without the proper importsā¦