[SOLVED] Cant loadModel with static rigidbody

If i do:

 Node rootNode = (Node) assetManager.loadModel(mapToload);

where mapToLoad = a string with path of j3o.

and in this j3o i have a spatial with static RigidBody added from SceneComposer, i get a error:

dic 31, 2022 3:32:09 PM class com.jme3.export.binary.BinaryImporter readObject(int id)
GRAVE: Exception
java.lang.NullPointerException
	at com.jme3.bullet.collision.PhysicsCollisionObject.readPcoProperties(PhysicsCollisionObject.java:1334)
	at com.jme3.bullet.objects.PhysicsRigidBody.read(PhysicsRigidBody.java:1275)
	at com.jme3.bullet.control.RigidBodyControl.read(RigidBodyControl.java:500)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:345)
	at com.jme3.export.binary.BinaryInputCapsule.resolveIDs(BinaryInputCapsule.java:510)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArray(BinaryInputCapsule.java:498)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArrayList(BinaryInputCapsule.java:616)
	at com.jme3.scene.Spatial.read(Spatial.java:1628)
	at com.jme3.scene.Geometry.read(Geometry.java:720)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:345)
	at com.jme3.export.binary.BinaryInputCapsule.resolveIDs(BinaryInputCapsule.java:510)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArray(BinaryInputCapsule.java:498)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArrayList(BinaryInputCapsule.java:616)
	at com.jme3.scene.Node.read(Node.java:768)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:345)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:245)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:128)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:112)
	at com.jme3.export.binary.BinaryLoader.load(BinaryLoader.java:36)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:272)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:388)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:439)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:444)
	at MapTool.MapUploader.run(MapUploader.java:29)
	at MapTool.MapRamLoader.startMapLoad(MapRamLoader.java:49)
	at com.mygame.Main.simpleInitApp(Main.java:65)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240)
	at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:548)
	at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:662)
	at java.base/java.lang.Thread.run(Thread.java:829)

java.lang.NullPointerException
	at com.jme3.scene.Spatial.runControlUpdate(Spatial.java:743)
	at com.jme3.scene.Spatial.updateLogicalState(Spatial.java:890)
	at com.jme3.scene.Node.updateLogicalState(Node.java:239)
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:265)
	at com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:580)
	at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:669)
	at java.base/java.lang.Thread.run(Thread.java:829)

1 Like

Which version of Minie is included in your application?

by gradle:

implementation "com.github.stephengold:Minie:5.0.0"
1 Like

That’s caused by a bug in Minie. I’ll get to work fixing it!

1 Like

Try:

implementation 'com.github.stephengold:Minie:7.0.1'

no, same error…

Please post the new stack trace.

full output:

JAVA_HOME="C:\Program Files\jmonkeyplatform\jdk"
cd C:\Users\gatto\Documents\jmonkey_project\TestGame; .\gradlew.bat --configure-on-demand -x check run
Configuration on demand is an incubating feature.
> Task :compileJava UP-TO-DATE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :assets:compileJava NO-SOURCE
> Task :assets:processResources
> Task :assets:classes
> Task :assets:jar

> Task :run
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/C:/Users/gatto/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-core/3.5.2-stable/fe2b20c9d088d1d2bcbe08abba9311df2f2dee7a/jme3-core-3.5.2-stable.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
gen 02, 2023 9:04:43 PM com.jme3.system.JmeDesktopSystem initialize
INFORMAZIONI: Running on jMonkeyEngine 3.5.2-stable
 * Branch: HEAD
 * Git Hash: 8ab3d24
 * Build Date: 2022-04-21
gen 02, 2023 9:04:43 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFORMAZIONI: LWJGL 3.3.1 build 7 context running on thread jME3 Main
 * Graphics Adapter: GLFW 3.4.0 Win32 WGL Null EGL OSMesa VisualC DLL
gen 02, 2023 9:04:43 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFORMAZIONI: OpenGL Renderer Information
 * Vendor: Intel
 * Renderer: Intel(R) Iris(R) Xe Graphics
 * OpenGL Version: 4.6.0 - Build 27.20.100.9624
 * GLSL Version: 4.60 - Build 27.20.100.9624
 * Profile: Compatibility
gen 02, 2023 9:04:43 PM com.jme3.renderer.opengl.GLRenderer setMainFrameBufferSrgb
AVVERTENZA: Driver claims that default framebuffer is not sRGB capable. Enabling anyway.
gen 02, 2023 9:04:44 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMAZIONI: Audio Renderer Information
 * Device: OpenAL Soft
 * Vendor: OpenAL Community
 * Renderer: OpenAL Soft
 * Version: 1.1 ALSOFT 1.21.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_device_clock ALC_SOFT_HRTF ALC_SOFT_loopback ALC_SOFT_loopback_bformat ALC_SOFT_output_limiter ALC_SOFT_pause_device
 * AL extensions: AL_EXT_ALAW AL_EXT_BFORMAT 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_BFORMAT AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_EXT_SOURCE_RADIUS AL_EXT_STEREO_ANGLES AL_LOKI_quadriphonic AL_SOFT_bformat_ex AL_SOFTX_bformat_hoa AL_SOFT_block_alignment AL_SOFTX_callback_buffer AL_SOFTX_convolution_reverb AL_SOFT_deferred_updates AL_SOFT_direct_channels AL_SOFT_direct_channels_remix AL_SOFT_effect_target AL_SOFT_events AL_SOFTX_filter_gain_ex AL_SOFT_gain_clamp_ex AL_SOFT_loop_points AL_SOFTX_map_buffer AL_SOFT_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length AL_SOFT_source_resampler AL_SOFT_source_spatialize
gen 02, 2023 9:04:44 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMAZIONI: Audio effect extension version: 1.0
gen 02, 2023 9:04:44 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMAZIONI: Audio max auxiliary sends: 2
Libbulletjme version 17.4.0 initializing
gen 02, 2023 9:04:44 PM com.jme3.bullet.objects.PhysicsRigidBody rebuildRigidBody
INFORMAZIONI: Created 1dbbacc9910.
gen 02, 2023 9:04:44 PM class com.jme3.export.binary.BinaryImporter readObject(int id)
GRAVE: Exception
java.lang.NullPointerException
	at com.jme3.bullet.objects.PhysicsRigidBody.rebuildRigidBody(PhysicsRigidBody.java:693)
	at com.jme3.bullet.objects.PhysicsRigidBody.read(PhysicsRigidBody.java:1291)
	at com.jme3.bullet.control.RigidBodyControl.read(RigidBodyControl.java:496)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:345)
	at com.jme3.export.binary.BinaryInputCapsule.resolveIDs(BinaryInputCapsule.java:510)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArray(BinaryInputCapsule.java:498)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArrayList(BinaryInputCapsule.java:616)
	at com.jme3.scene.Spatial.read(Spatial.java:1628)
	at com.jme3.scene.Geometry.read(Geometry.java:720)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:345)
	at com.jme3.export.binary.BinaryInputCapsule.resolveIDs(BinaryInputCapsule.java:510)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArray(BinaryInputCapsule.java:498)
	at com.jme3.export.binary.BinaryInputCapsule.readSavableArrayList(BinaryInputCapsule.java:616)
	at com.jme3.scene.Node.read(Node.java:768)
	at com.jme3.export.binary.BinaryImporter.readObject(BinaryImporter.java:345)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:245)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:128)
	at com.jme3.export.binary.BinaryImporter.load(BinaryImporter.java:112)
	at com.jme3.export.binary.BinaryLoader.load(BinaryLoader.java:36)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:272)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:388)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:439)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:444)
	at MapTool.MapUploader.run(MapUploader.java:29)
	at MapTool.MapRamLoader.startMapLoad(MapRamLoader.java:49)
	at com.mygame.Main.simpleInitApp(Main.java:64)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240)
	at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:548)
	at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:662)
	at java.base/java.lang.Thread.run(Thread.java:829)

gen 02, 2023 9:04:44 PM com.jme3.bullet.objects.PhysicsRigidBody rebuildRigidBody
INFORMAZIONI: Created 1dbbaccb5c0.
gen 02, 2023 9:04:44 PM com.jme3.bullet.objects.PhysicsRigidBody setGravity
AVVERTENZA: The body isn't in any PhysicsSpace, and its gravity isn't protected. Unless protection is set, adding it to a PhysicsSpace will override its gravity.
gen 02, 2023 9:04:44 PM com.jme3.app.LegacyApplication handleError
GRAVE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.NullPointerException
	at com.jme3.scene.Spatial.runControlUpdate(Spatial.java:743)
	at com.jme3.scene.Spatial.updateLogicalState(Spatial.java:890)
	at com.jme3.scene.Node.updateLogicalState(Node.java:239)
	at com.jme3.app.SimpleApplication.update(SimpleApplication.java:265)
	at com.jme3.system.lwjgl.LwjglWindow.runLoop(LwjglWindow.java:580)
	at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:669)
	at java.base/java.lang.Thread.run(Thread.java:829)


Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 11s
4 actionable tasks: 3 executed, 1 up-to-date

1 Like

A bug, obviously, but a different one. I am working on a fix.

Please try:

implementation 'com.github.stephengold:Minie:7.0.2'
3 Likes

now works fine! load the model (no error) and with addAll add the RidigidBody!!

(output if you need)

JAVA_HOME="C:\Program Files\jmonkeyplatform\jdk"
cd C:\Users\gatto\Documents\jmonkey_project\TestGame; .\gradlew.bat --configure-on-demand -x check run
Configuration on demand is an incubating feature.
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :assets:compileJava NO-SOURCE
> Task :assets:processResources UP-TO-DATE
> Task :assets:classes UP-TO-DATE
> Task :assets:jar UP-TO-DATE

> Task :run
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jme3.util.ReflectionAllocator (file:/C:/Users/gatto/.gradle/caches/modules-2/files-2.1/org.jmonkeyengine/jme3-core/3.5.2-stable/fe2b20c9d088d1d2bcbe08abba9311df2f2dee7a/jme3-core-3.5.2-stable.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
gen 03, 2023 7:07:17 PM com.jme3.system.JmeDesktopSystem initialize
INFORMAZIONI: Running on jMonkeyEngine 3.5.2-stable
 * Branch: HEAD
 * Git Hash: 8ab3d24
 * Build Date: 2022-04-21
gen 03, 2023 7:07:17 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
INFORMAZIONI: LWJGL 3.3.1 build 7 context running on thread jME3 Main
 * Graphics Adapter: GLFW 3.4.0 Win32 WGL Null EGL OSMesa VisualC DLL
gen 03, 2023 7:07:17 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
INFORMAZIONI: OpenGL Renderer Information
 * Vendor: Intel
 * Renderer: Intel(R) Iris(R) Xe Graphics
 * OpenGL Version: 4.6.0 - Build 27.20.100.9624
 * GLSL Version: 4.60 - Build 27.20.100.9624
 * Profile: Compatibility
gen 03, 2023 7:07:17 PM com.jme3.renderer.opengl.GLRenderer setMainFrameBufferSrgb
AVVERTENZA: Driver claims that default framebuffer is not sRGB capable. Enabling anyway.
gen 03, 2023 7:07:17 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMAZIONI: Audio Renderer Information
 * Device: OpenAL Soft
 * Vendor: OpenAL Community
 * Renderer: OpenAL Soft
 * Version: 1.1 ALSOFT 1.21.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_device_clock ALC_SOFT_HRTF ALC_SOFT_loopback ALC_SOFT_loopback_bformat ALC_SOFT_output_limiter ALC_SOFT_pause_device
 * AL extensions: AL_EXT_ALAW AL_EXT_BFORMAT 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_BFORMAT AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_EXT_SOURCE_RADIUS AL_EXT_STEREO_ANGLES AL_LOKI_quadriphonic AL_SOFT_bformat_ex AL_SOFTX_bformat_hoa AL_SOFT_block_alignment AL_SOFTX_callback_buffer AL_SOFTX_convolution_reverb AL_SOFT_deferred_updates AL_SOFT_direct_channels AL_SOFT_direct_channels_remix AL_SOFT_effect_target AL_SOFT_events AL_SOFTX_filter_gain_ex AL_SOFT_gain_clamp_ex AL_SOFT_loop_points AL_SOFTX_map_buffer AL_SOFT_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length AL_SOFT_source_resampler AL_SOFT_source_spatialize
gen 03, 2023 7:07:17 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMAZIONI: Audio effect extension version: 1.0
gen 03, 2023 7:07:17 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
INFORMAZIONI: Audio max auxiliary sends: 2
Libbulletjme version 17.4.0 initializing
gen 03, 2023 7:07:18 PM com.jme3.bullet.objects.PhysicsRigidBody rebuildRigidBody
INFORMAZIONI: Created 157c22fe690.
gen 03, 2023 7:07:18 PM com.jme3.bullet.objects.PhysicsRigidBody rebuildRigidBody
INFORMAZIONI: Created 157c22ff680.
gen 03, 2023 7:07:18 PM com.jme3.bullet.objects.PhysicsRigidBody cloneFields
INFORMAZIONI: Created 157c22ffce0
gen 03, 2023 7:07:18 PM com.jme3.bullet.objects.PhysicsRigidBody rebuildRigidBody
INFORMAZIONI: Created 157c22fe030.
gen 03, 2023 7:07:18 PM com.jme3.bullet.objects.PhysicsRigidBody setGravity
AVVERTENZA: The body isn't in any PhysicsSpace, and its gravity isn't protected. Unless protection is set, adding it to a PhysicsSpace will override its gravity.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 6s
4 actionable tasks: 2 executed, 2 up-to-date

1 Like

I’m glad that worked.