SDK crossing out animation import files with a red line

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?

Also, where are the sample models stored? Like the Ninja, teapot, and so on.
Thanks in advance…

1 Like

Hello, and welcome to community :slight_smile:

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.

Hi @Randamixer , welcome to jme community…

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…

Link for jme3-testdata.jar :

1 Like

Thanks for the reply. I don’t know why, but now it says that the Nullpointer is on line 37.

Here is the code.

Because control is null. So control.anything will cause an NPE.

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.

How can I make it not null?

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.)