Ragdoll issue - gltf model (bonus gradle discussion)

Hello,

not sure why it happened.

I got 2 models, with similar armature.

First is exported via gltf so have different bone names like “Armature_Something” other was blender file exported so have just “Something”.

Anyway i use same test java files for both, the only difference is in bone names and file to load name.

And only with character First model i receive exception like:

SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.ClassCastException: java.nio.DirectShortBufferU cannot be cast to java.nio.ByteBuffer
at com.jme3.bullet.control.ragdoll.RagdollUtils.getPoints(RagdollUtils.java:229)
at com.jme3.bullet.control.ragdoll.RagdollUtils.makeShapeFromVerticeWeights(RagdollUtils.java:203)
at com.jme3.bullet.control.KinematicRagdollControl.boneRecursion(KinematicRagdollControl.java:534)
at com.jme3.bullet.control.KinematicRagdollControl.scanSpatial(KinematicRagdollControl.java:515)
at com.jme3.bullet.control.KinematicRagdollControl.createSpatialData(KinematicRagdollControl.java:467)
at com.jme3.bullet.control.AbstractPhysicsControl.setSpatial(AbstractPhysicsControl.java:182)
at com.jme3.scene.Spatial.addControl(Spatial.java:769)
at test.RagdollTest3.simpleInitApp(RagdollTest3.java:130)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:220)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:211)
at java.lang.Thread.run(Thread.java:748)

even when i add only “ragdoll.addBoneName(“Armature_Root”);”

i dont have this error when i add non exist bone like “ragdoll.addBoneName(“dsfgsdfghdgf”);”
but then ragdoll dont work ofc.

Second model work nice, ragdoll works.

what can be the issue? gltf importer issue?

1 Like

I don’t know what version of JME you are running and the stack trace doesn’t line up with the current source code… but an educated guess is that the ragdoll util is assuming that all bone indexes will be bytes but gltf is importing unsigned short buffers.

I think this is a bug/limitation in the ragdoll utils… it’s just expecting a very narrow type of model.

1 Like

DynamicAnimControl is more flexible than KinematicRagdollControl. It handles bone indices that are unsigned short.

1 Like

about DynamicAnimControl :
yup, i awaits for this one. it will be in JME 3,.3 right? as this is feature. i dont want create jme fork :slight_smile:

also hope it will not break on using “setUserControl” because need face/body customization

Anyway about KinematicRagdollControl:
it works, but if i export SAME model via blender exporter in SDK.

exporting via gltf giving this odd issue.

so i really also not sure if DynamicAnimControl will work too. because it looks more like exporter issue?

same model work via blender export and dont work via gltf export(ofc need change bone names for both exports and child for anim - so i tested properly)
yyyyyyyyyy

1 Like

If you’re on JME 3.2, you can start using DynamicAnimControl any time you want. You don’t have to wait for JME 3.3 to be released.

I agree with @pspeed that the differences you’re seeing between glTF and straight Blender probably have to do with the layout of the bone-index buffers. I’ve tested DynamicAnimControl on a similar model (glTF with 16-bit bone indices) and it worked. Of course, without access to your models, I can’t be sure they will work.

Of course, you can open a GitHub issue for KinematicRagdollControl not working with 16-bit bone indices, and I’ll fix it if I can. But I see that route as a dead end.

By the way, Bone.setUserControl() is a feature of the old (pre-3.3) animation system. It will be deprecated in JME 3.3, as will KinematicRagdollControl.

1 Like

Im currently on:
v3.2.1-stable-sdk3

but jme IDE(netbeans based one) dont see DynamicAnimControl on ctrl-space :smiley:

also dont see in: jmonkeyengine/jme3-bullet/src/common/java/com/jme3/bullet/control at master · jMonkeyEngine/jmonkeyengine · GitHub

How can i use it then? i thought i need create jme3 fork and add jour job there.

about deprecated Bone.setUserControl() - what should i use then for customizing character? currently it works perfect for me - i can customize character and it work with animations.

edit: ahh i see, there is removed line “which is part of the Jme3-utilities project” in your post. so its only Minie project related? im not familiar with it much. just wanted DynamicAnimControl. Anyway if you can instruct me where and how add Minie i would be grateful.

1 Like

I’m on 3.2.1-stable-sdk3 myself, so I can certainly instruct you. I’ll need to know which build system your project uses: Ant or Gradle?

1 Like

thanks Stephen, i use Standard JME IDE(Netbeans based one) that use Ant, nothing changed, all configuration are default (almost all, because there was added some code encoding on full build(not runtime) by team member, but anyway it was disabled temporary as i know)

1 Like

I just wrote up some detailed instructions for adding Minie to an existing JME project:

GitHub - stephengold/Minie: Integrate Bullet Physics and V-HACD into jMonkeyEngine projects. (code has New BSD license)

I welcome any constructive feedback on this document.

The physics API is about 90% unchanged from jme3-bullet to Minie. The biggest changes
are the removal of CharacterControl and KinematicRagdollControl.

I expect the hard part will be switching from KinematicRagdollControl to DynamicAnimControl.
The code in the MinieExamples subproject may prove instructive.

Feel free to post questions/issues here or send me a private message. I’ll support you as best I can.

2 Likes

thanks, will try it for sure.

Im using CharacterControl for player control(where i even reported issue with setUp for linux/windows issues as u remember :slight_smile: ), but i understand there are some alternatives so can replace with something.

Most important is ragdoll so will try it first place. Also important is maintain Character customization i made. You said that Bone.setUserControl( will be deprecated. Could you please tell me if there is some alternative or why its deprecated(i understand there is other way, or just dont need set it?)

anyway i understand it will come to JME in future release( i hope so) not sure why you dont have core developer, but hope you will get soon :slight_smile:

1 Like

Bone.setUserControl() is still fine for JME 3.2.x . It won’t be deprecated until 3.3 .
I’ve haven’t looked much at MonkAnim (the JME 3.3 animation system), so I’m unsure
what the JME 3.3 equivalent of setUserControl() would be. Perhaps simply
mask off the Joint in the AnimationControl?

With DynamicAnimControl you can have as many (or few) kinematic bones as you want.
So you could have the arms, legs, and neck dynamic but keep the facial bones kinematic.
There maybe some issues if DynamicAnimControl tries to clear the user-control
flags on those bones. We’ll see…

1 Like

The alternative to CharacterControl is called BetterCharacterControl, and it’s included in both jme3-bullet and Minie.

1 Like

all fine, but when i added All Jars, i still dont have for example:

(MinieExamples only)
import jme3utilities.ui.ActionApplication;
import jme3utilities.ui.InputMode;

am i missing something?

hhhyyyy

also anyway some tests dont have this issue, but when try run them i got:

Exception in thread “main” java.lang.UnsatisfiedLinkError: The required native library ‘bulletjme’ was not found in the classpath via ‘native/windows/x86_64/bulletjme.dll’. Error message: no bulletjme in java.library.path
at com.jme3.system.NativeLibraryLoader.loadNativeLibrary(NativeLibraryLoader.java:596)
at com.jme3.system.JmeDesktopSystem.initialize(JmeDesktopSystem.java:348)
at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:271)
at com.jme3.system.JmeSystem.newContext(JmeSystem.java:162)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:461)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:424)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:125)
at jme3utilities.minie.test.TestScaleChange.main(TestScaleChange.java:53)

(as i understand i properly get rid of native bullet JME libs, replacing them with Minie Jar, so why it dont work?)

UnsatisfiedLinkError is about JNI c libs right? should i include it somehow to classpath?(this bulletjme.dll but idk where it is) hoped there will be less dependencies

That MinieLibrary.jar looks like something you built yourself. To get you started, I recommend downloading the prebuilt JAR from GitHub.

1 Like

right, i even mark i build it myself. thought it will work, ok will try use ready2use one.

ActionApplication is only needed to run the examples. The Minie library doesn’t need it.

Since the examples don’t include build instructions for Ant, the easiest way to run them is to install Gradle.

1 Like

ok, but as i understand im ready to make tests myself based on tests source code.

ActionApplication is trully some extended(with not trully required things) SimpleApplication or LegacyApplication right?

the only thing stay to fix for me is this error

Exception in thread “main” java.lang.UnsatisfiedLinkError: The required native library ‘bulletjme’ was not found in the classpath via ‘native/windows/x86_64/bulletjme.dll’. Error message: no bulletjme in java.library.path
at com.jme3.system.NativeLibraryLoader.loadNativeLibrary(NativeLibraryLoader.java:596)
at com.jme3.system.JmeDesktopSystem.initialize(JmeDesktopSystem.java:348)
at com.jme3.system.JmeDesktopSystem.newContext(JmeDesktopSystem.java:271)
at com.jme3.system.JmeSystem.newContext(JmeSystem.java:162)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:461)
at com.jme3.app.LegacyApplication.start(LegacyApplication.java:424)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:125)
at jme3utilities.minie.test.TestScaleChange.main(TestScaleChange.java:53)

that im not sure why its needed, maybe i messed something with project, because JME projects see them, or its Minie exclusive?

where is bulletjme.dll, because currently i dont know.

@sgold above

Yes. ActionApplication is found in the jme3-utilities-ui library. It extends SimpleApplication.

1 Like

With jme3-bullet the bulletjme native libraries are typically provided by
a separate jme3-bullet-native library. With Minie they’re included in
the class JAR. If they’re missing, it’s likely because your MinieLibrary.jar
wasn’t built properly and omitted them.

1 Like

right, anyway when i use ready2use Jar of minie, it works.

At least examples that dont need ActionApplication :slight_smile:

zzzzz

2 Likes