jMonkeyEngine 3 Tutorial (7) - Hello Animation

https://wiki.jmonkeyengine.org/jme3/beginner/hello_animation.html

https://javadoc.jmonkeyengine.org/v3.3.0-beta1/com/jme3/animation/AnimControl.html

Does this example still work. I am getting:

Uncaught exception thrown in Thread[jME3 Main,5,main]
NullPointerException

I know some of the classes are deprecated.

Thanks

if you exported model to j3o using 3.3 or loaded other format using 3.3, then you have AnimComposer control. If you load old 3.2 j3o file - it should still have AnimControl control in it.(even when you use 3.3)

Welcome to the community :slight_smile:

Please post the entire stacktrace when reporting issues. It will help us answer your question a lot quicker.

1 Like

I started with the model that I believe was in test-data. Thinking the model may have changed I found an old copy from 2013 but still have an error. Maybe the tutorial page could have a link to the correct model for example to work.

Thanks

What page and/or what model?

I don’t think that the old models were redone with gltf export.

Project without jme-test-data
Uncaught exception thrown in Thread[jME3 Main,5,main]
AssetNotFoundException: Models/Oto/Oto.mesh.xml

Project with jme3-test-data
run:
Apr 29, 2020 10:32:31 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.3.0-beta1

  • Branch: HEAD
  • Git Hash: bd1b6d2
  • Build Date: 2020-02-07
    Apr 29, 2020 10:32:33 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
    INFO: LWJGL 2.9.3 context running on thread jME3 Main
  • Graphics Adapter: C:\WINDOWS\System32\DriverStore\FileRepository\nvam.inf_amd64_1aae4f19e68d0780\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvam.inf_amd64_1aae4f19e68d0780\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvam.inf_amd64_1aae4f19e68d0780\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvam.inf_amd64_1aae4f19e68d0780\nvldumdx.dll
  • Driver Version: null
  • Scaling Factor: 1
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/C:/Program%20Files/jmonkeyplatform/jmonkeyplatform/libs/jme3-core-3.3.0-beta1.jar) to method sun.nio.ch.DirectBuffer.cleaner()
    WARNING: Please consider reporting this to the maintainers of com.jme3.util.ReflectionAllocator
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    Apr 29, 2020 10:32:33 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
    INFO: OpenGL Renderer Information
  • Vendor: NVIDIA Corporation
  • Renderer: GeForce GTX 970M/PCIe/SSE2
  • OpenGL Version: 4.6.0 NVIDIA 388.57
  • GLSL Version: 4.60 NVIDIA
  • Profile: Compatibility
    Apr 29, 2020 10:32:33 AM com.jme3.asset.AssetConfig loadText
    WARNING: Cannot find loader com.jme3.scene.plugins.blender.BlenderModelLoader
    Apr 29, 2020 10:32:33 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    INFO: Audio Renderer Information
  • Device: OpenAL Soft
  • Vendor: OpenAL Community
  • Renderer: OpenAL Soft
  • Version: 1.1 ALSOFT 1.15.1
  • Supported channels: 64
  • ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
  • AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
    Apr 29, 2020 10:32:33 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    WARNING: Pausing audio device not supported.
    Apr 29, 2020 10:32:33 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    INFO: Audio effect extension version: 1.0
    Apr 29, 2020 10:32:33 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    INFO: Audio max auxiliary sends: 4
    Apr 29, 2020 10:32:34 AM com.jme3.app.LegacyApplication handleError
    SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
    java.lang.NullPointerException
    at mygame.HelloAnimation.simpleInitApp(HelloAnimation.java:39)
    at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:239)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
    at java.base/java.lang.Thread.run(Thread.java:834)

BUILD SUCCESSFUL (total time: 16 seconds)

Project with old file from 2013 in Models folder.
run:
Apr 29, 2020 10:46:44 AM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.3.0-beta1

  • Branch: HEAD
  • Git Hash: bd1b6d2
  • Build Date: 2020-02-07
    Apr 29, 2020 10:46:47 AM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
    INFO: LWJGL 2.9.3 context running on thread jME3 Main
  • Graphics Adapter: C:\WINDOWS\System32\DriverStore\FileRepository\nvam.inf_amd64_1aae4f19e68d0780\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvam.inf_amd64_1aae4f19e68d0780\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvam.inf_amd64_1aae4f19e68d0780\nvldumdx.dll,C:\WINDOWS\System32\DriverStore\FileRepository\nvam.inf_amd64_1aae4f19e68d0780\nvldumdx.dll
  • Driver Version: null
  • Scaling Factor: 1
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/C:/Program%20Files/jmonkeyplatform/jmonkeyplatform/libs/jme3-core-3.3.0-beta1.jar) to method sun.nio.ch.DirectBuffer.cleaner()
    WARNING: Please consider reporting this to the maintainers of com.jme3.util.ReflectionAllocator
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    Apr 29, 2020 10:46:47 AM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
    INFO: OpenGL Renderer Information
  • Vendor: NVIDIA Corporation
  • Renderer: GeForce GTX 970M/PCIe/SSE2
  • OpenGL Version: 4.6.0 NVIDIA 388.57
  • GLSL Version: 4.60 NVIDIA
  • Profile: Compatibility
    Apr 29, 2020 10:46:48 AM com.jme3.asset.AssetConfig loadText
    WARNING: Cannot find loader com.jme3.scene.plugins.blender.BlenderModelLoader
    Apr 29, 2020 10:46:48 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    INFO: Audio Renderer Information
  • Device: OpenAL Soft
  • Vendor: OpenAL Community
  • Renderer: OpenAL Soft
  • Version: 1.1 ALSOFT 1.15.1
  • Supported channels: 64
  • ALC extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX ALC_EXT_thread_local_context ALC_SOFT_loopback
  • AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
    Apr 29, 2020 10:46:48 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    WARNING: Pausing audio device not supported.
    Apr 29, 2020 10:46:48 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    INFO: Audio effect extension version: 1.0
    Apr 29, 2020 10:46:48 AM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    INFO: Audio max auxiliary sends: 4
    Apr 29, 2020 10:46:48 AM com.jme3.app.LegacyApplication handleError
    SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
    java.lang.NullPointerException
    at mygame.HelloAnimation.simpleInitApp(HelloAnimation.java:39)
    at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:239)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
    at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
    at java.base/java.lang.Thread.run(Thread.java:834)

BUILD SUCCESSFUL (total time: 11 seconds)

That isn’t a tutorial or model

Sorry to many pages open.
https://wiki.jmonkeyengine.org/jme3/beginner/hello_animation.html

Hi,

In the stacktrace you have : AssetNotFoundException: Models/Oto/Oto.mesh.xml

So the resources isn’t in your classpath.
Probably add dependency to the test data module : org.jmonkeyengine:jme3-testdata:3.3.0-alpha2
jme3-testdata only exist in 3.3.0-alpha2 (for the last version)

For example with gradle :
runtimeOnly ‘org.jmonkeyengine:jme3-testdata:3.3.0-alpha2’

There is no problem with the wiki.

The files are ogre files and the conversion to j3o should use the old anim system.

The new anim system will be added soon to the wiki but this is not affecting the tutorial currently.

I got this to work with Jaime (once I changed Stand to Idle in the code), but still cannot get this to work for Oto. When I look at Oto it has AnimComposer not AnimControl.

I must apologize, you are correct. The model is not broken. The xml version now requires AnimComposer to load.

So you have to use "Models/Oto/OtoOldAnim.j3o" or use AnimComposer instead of AnimControl.

This makes no sense to me since these are ogre files so they should load as they used to since the AnimControl is only deprecated.

From version 3.3 the loading of assets will by default create an AnimComposer instead of the deprecated AnimControl. Since you are loading an ogre.xml file, the ‘conversion’ will take place.

The OtoOldAnim.j3o is a j3o file and will be loaded as-is. If it has the old AnimControl and SkeletonControl, they will still be there to use them if you want.

Yes, but shouldn’t a breaking change like that just remove AnimControl period? First time I ran into a deprecated that made breaking changes so just wondering…

If you would completely remove it, old models would not work anymore.

If I had a production game using jme 3.2, I can still upgrade to jme 3.3 without an issue. (given that for a production game I would use .j3o files)
For new implementations (loading new .gltf models for example) I would need to use the new way of working.

I guess it’s introduced in phases:
phase 1: introduce the new system and deprecate the old system
phase 2: use the new system by default
phase 3: remove the old system

True, but this is now the case for all ogre xmll files people used in their projects for testing. So I still dont get why this was not done in a way that allowed the old projects to work until AnimControl is removed.

So should the wiki page be updated to explain the issues around the model.
Maybe change:

player = (Node) assetManager.loadModel(“Models/Oto/Oto.mesh.xml”);

to

player = (Node) assetManager.loadModel(“Models/Oto/OtoOldAnim.j3o”);

If someone just downloads and tries to follow the steps as is this 
does not seem to work.

What “Deprecated” Means

You may have heard the term, “self-deprecating humor,” or humor that minimizes the speaker’s importance. A deprecated class or method is like that. It is no longer important. It is so unimportant, in fact, that you should no longer use it, since it has been superseded and may cease to exist in the future.

Java provides a way to express deprecation because, as a class evolves, its API (application programming interface) inevitably changes: methods are renamed for consistency, new and better methods are added, and fields change. But such changes introduce a problem. You need to keep the old API around until developers make the transition to the new one, but you don’t want them to continue programming to the old API.

The ability to deprecate a class, method, or member field solves the problem. Java supports two mechanisms for deprecation: and an annotation, (supported starting with J2SE 5.0) and a Javadoc tag (supported since 1.1). Existing calls to the old API continue to work, but the annotation causes the compiler to issue a warning when it finds references to deprecated program elements. The Javadoc tag and associated comments warn users against using the deprecated item and tell them what to use instead.

Key lines,
since it has been superseded and may cease to exist in the future.

You need to keep the old API around until developers make the transition to the new one, but you don’t want them to continue programming to the old API.

Existing calls to the old API continue to work,

I think that it should stay the same and the change should be made in the engine, where it belongs, but that won’t happen I think.