Hello!
I have been seeing the tutorials for JMonkeyEngine for 3 days now. So, I only have 3 days of experience. I saw the Hello Animation project and copied the source code into the SDK. However, when I do that, the SDK crosses out the AnimChanel, AnimControl, AnimEventListener, and so on with a red line. When I run the code, it throws a null pointer exception. I haven’t changed anything, so what could be the problem?
As you can see, you have Nullpointer in 38 line, but you didnt provide us that line.
in 38 line you have some your variable that is Null. You just need fix it, so it have value. (for example you search wrong Spatial for animation control and you have null)
So you would need first check what is null there and then we can know what is wrong.
That’s because this is the old animation system which is deprecated, the current new animation system documentation is still a WIP, but you still can use jme3 old animation…
here are some examples using the new system from jme3 :
Other examples on my repo on the new system using jme3-android :
Yeh, this happens because you haven’t had the models used by AssetManager that’s used in these java code examples on your local disk, ie instances extracted from assetManagerLoaders are nullptrs. (if you havenot really changed code as you say)
In order to download those assets Ninja, teaspot, jack, jaime locally you have to download jme3-testdata.jar file from SonaType & add it as a jar dependency, in the libraries dropdown folder menu inside the projects tab bar…
Thanks for the reply. From my understanding, I won’t be able to run the code, correct? I already have the jme3-test-data library. I downloaded the library that you have linked and the code still won’t work. Also, how can I view the models from the SDK? A screenshot would help.
Quoting from the tutorial,
This line of code will return NULL if the AnimControl is not in the main node of your model.
control = player.getControl(AnimControl.class);
To check this, RMB select your model and click “Edit in SceneComposer” if the models file extension is .j3o, or “View” if not. You can then see the tree for the model so you can locate the node the control resides in. You can access the subnode with the following code.
The thing is, I can’t see the model even after adding the jme3 test data library to the library list.
By getting AnimComposer instead of the old deprecated AnimControl. (And/or getting it from the right child depending on if it’s on the root node or not.)