Ragdoll issue - gltf model (bonus gradle discussion)

That’s progress!

1 Like

but still have some problem with ragdoll testCase.

i loaded MinieLibrary into my project, removed jme-bullet libs to get rid of conflicts.

Replaced ragdoll test file code to match DynamicAnimControl.

and i got

  sty 08, 2019 3:42:06 AM com.jme3.app.LegacyApplication handleError
  SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
  java.lang.NoClassDefFoundError: jme3utilities/Validate
	at com.jme3.bullet.PhysicsSpace.<init>(PhysicsSpace.java:265)
	at com.jme3.bullet.BulletAppState.createPhysicsSpace(BulletAppState.java:450)
	at com.jme3.bullet.BulletAppState.startPhysics(BulletAppState.java:411)
	at com.jme3.bullet.BulletAppState.stateAttached(BulletAppState.java:560)
	at com.jme3.app.state.AppStateManager.attach(AppStateManager.java:133)
	at test.RagdollTest3.simpleInitApp(RagdollTest3.java:76)
	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)
  Caused by: java.lang.ClassNotFoundException: jme3utilities.Validate
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
  	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  	... 10 more

still some class missing :frowning:

it break on:

    bulletAppState = new BulletAppState();
    bulletAppState.setEnabled(true);
    //bulletAppState.setDebugEnabled(true);
    stateManager.attach(bulletAppState);

“stateManager.attach(bulletAppState);”

The Validate class is part of the jme3-utilities-heart library. Is that lib included?

1 Like

Ah right, i thought when i added it to MinieLibrary it will get it from there, but needed add it again into my project :slight_smile:

But now i got:

sty 08, 2019 3:47:47 AM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.UnsatisfiedLinkError: com.jme3.bullet.collision.PhysicsCollisionObject.getCollisionFlags(J)I
at com.jme3.bullet.collision.PhysicsCollisionObject.getCollisionFlags(Native Method)
at com.jme3.bullet.objects.PhysicsRigidBody.postRebuild(PhysicsRigidBody.java:962)
at com.jme3.bullet.objects.PhysicsRigidBody.rebuildRigidBody(PhysicsRigidBody.java:1003)
at com.jme3.bullet.control.RigidBodyControl.setSpatial(RigidBodyControl.java:383)
at com.jme3.scene.Spatial.addControl(Spatial.java:769)
at jme3test.bullet.PhysicsTestHelper.createPhysicsTestWorld(PhysicsTestHelper.java:82)
at test.RagdollTest3.simpleInitApp(RagdollTest3.java:82)
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)

i think i still have somethign using JME bullet, will see what it is and why (since i removed JME bullet libs)

When i also add Minie.jar (4 libs total of minie) then i got:

Exception in thread “main” java.lang.UnsatisfiedLinkError: Failed to extract native library to: D:\GameProjects\Project name\bulletjme.dll
at com.jme3.system.NativeLibraryLoader.loadNativeLibrary(NativeLibraryLoader.java:668)
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 test.RagdollTest3.main(RagdollTest3.java:54)

i need g2g to sleep, hope you will help me with this :slight_smile: if you will say i need gradle, then how use it in JME IDE. (or need out of it) - btw. now you know why i dont like external projects :smiley: everything can mess up

I do see why you don’t like external projects.
And now perhaps you understand why I don’t use Ant any more.
The takeaway, I suppose, is that Gradle makes external dependencies easy.

Installing the Gradle Support plugin in the SDK should be simple. I’ve done it
for many versions of the SDK.

  1. “Tools → Plugins” menu to open the “Plugins” tool.
  2. Find the Gradle Support item in the “Available Plugins” tab and check the box next to it.
  3. Click on the “Install” button and follow the prompts from there.

There’s one other plugin it depends on—something to do with Groovy, I believe—and you’ll have to restart the IDE.

Fair warning: last week, when I tried to add Gradle Support to v3.2.2-stable-sdk1, I couldn’t find it.
Perhaps I was being blind, or perhaps it’s been removed.

I need to eat some dinner. We can resume this process in 12-14 hours.

last week, when I tried to add Gradle Support to v3.2.2-stable-sdk1, I couldn’t find it.
Perhaps I was being blind, or perhaps it’s been removed.

i cant find it now :smiley:

not sure if related:

so i belive the one correct is:
https://github.com/kelemen/netbeans-gradle-project/releases/download/v1.4.2/netbeans-gradle-plugin-1.4.2.nbm

so i got it, but if you will have free time, please explain how to use it, i always were using default netbeans ant.
GitHub - stephengold/Minie: Integrate Bullet Physics and V-HACD into jMonkeyEngine projects. (code has New BSD license) - not sure where should i add this lines into project

edit:
so i should create now graddle project where inside will be JME project right? like wrapper? i need learn about graddle…

@sgold so

  1. downloaded GitHub - Nehon/base-jme at 1.0.0
  2. added your changes from : GitHub - stephengold/Minie: Integrate Bullet Physics and V-HACD into jMonkeyEngine projects. (code has New BSD license)

it looks ok, but overall project dont build because i were using my other projects JARS. Now i dont know how to add them. compile fileTree(dir: ‘libs’, include: [‘*.jar’]) is ok? (even if then now i need update their versions manually ;/)

also im unable to open assets folder in IDE to see any assets, i see there is resource folder in src, but seen Nehon had assets folders inside assets folder in project, but in IDE its just as “subprojects → assets” that i cant open via 2-click → open: assets

so i got issues like:

  1. Cant quick use IDE tools on assets, because cant open assets folder (if added as source then no tool options)
  2. each run of single test file make Looong build time, in ant i had something like “compile on save” and every change in single asset dont made single file run again doing full build time…
  3. still trying get ragdoll to work

If you want to do serious software development using Java,
then learning Gradle is probably a good investment of time and effort.

However, I want to emphasize that Gradle is not necessary if
you simply want to use Minie in your project.
I wrote up instructions to add Minie to either project type.
If the instructions for Ant-based projects are not working for you,
I need to understand why.

Gradle support is only required if you want to build/run a Gradle-based project.
MinieLibrary and MinieExample are Gradle-based (sub)projects. It looks like you
tried to convert them to Ant-based projects. If so, they might no longer work with Gradle.
Now that you’ve installed the Gradle Support plugin, you should either revert
your changes or start over with a fresh copy of the Minie repo.

Since your personal project is Ant-based, Gradle Support won’t benefit it unless
you convert it to a Gradle-based project. This is a non-trival conversion, but I’ll
provide a few pointers.

Just as the build instructions for an Ant-based build are stored in a build.xml file
and files referenced by it (nbproject/build-impl.xml in NetBeans), the build
instructions for a Gradle-based project are stored in a build.gradle file and files
referenced by it. build.gradle is written in an executable language: either
Kotlin or Groovy, neither of which I’m proficient in.

Once you have a working build.gradle, the instructions about adding repos
and dependencies will make more sense.

The Gradle user manual is online at: Gradle User Manual
Two caveats:

  1. The user manual is for the latest version (5.1) which is probably not the version provided
    by the plugin.
  2. The user manual assumes fluency in Kotlin/Groovy, which might take awhile to acquire.

The plugin provides wizards to bootstrap new projects. In the IDE, “File → New project” to
open the “New Project” dialog. Under “Categories” select “Gradle”. Under “Projects” select
“Single Gradle Project”. This creates a generic Gradle-based project without any JME libraries.

Since your project is JME-based, it’s even better to start with an existing JME Gradle
project such as BasicGame-on-Gradle:
GitHub - stephengold/BasicGame-on-Gradle: jMonkeyEngine's prototypical BasicGame implemented as a Gradle project

Clone the repo and run it once to make sure it’s working. Then delete Main.java.
Copy the Java source files from your Ant project into the src/main/java directory of
the Gradle project. Copy the assets from your Ant project into the src/main/resources
directory of the Gradle project. Edit build.gradle to change the mainclass property
and uncomment whichever libraries you need.

You’ll probably want to rename the project also.

@sgold i think you might not understand me.

i got working gradle project, but with some “inconvenience”.

When you use gradle i dont belive you wait all project to build to run single test file after changing just one asset…

please note i dont see anything about assets in:

also i have assets building in GitHub - Nehon/bootmonkey: Project scaffolding for JME3 but anyway got below “inconvenience”.

This inconvenience are:

When i changed single asset using @nehon gradle template and run single test file i needed to wait gradle to build ALL project each time. (in ant i had “compile on save” option in IDE that dont needed build everything so i ask if in gradle is something similar)

about last point 3) i got issue

Uncaught exception thrown in Thread[jME3 Main,5,main]
RendererException: compile error in: ShaderSource[name=Common/MatDefs/Light/PBRLighting.vert, defines, type=Vertex, language=GLSL150]
Vertex shader failed to compile with the following errors:
ERROR: 0:160: error(#102) #error: NUM_BONES must be between 1 and 255.
ERROR: 0:167: error(#186) Array size must be a positive integer
ERROR: error(#273) 2 compilation errors. No code generated

while i add bones like

    LinkConfig hull = new LinkConfig(1f, MassHeuristic.Density,
            ShapeHeuristic.VertexHull, new Vector3f(1f, 1f, 1f),
            CenterHeuristic.Mean);
    ragdoll.setConfig(torsoName, hull);
            ragdoll.link("Armature_Torso", hull, new RangeOfMotion(1f, -0.4f, 0.8f, -0.8f, 0.4f, -0.4f));

but i dont even want to try fix it, because each time i run my test file i need wait ALL build to finish…
thats why i ask about answer for question how to speed up build when only one file changed because i belive you dont wait yourself for all project build when only one asset changed and you probably have some way to convert model to j3o from IDE usigng gradle bootmoney made by Nehon. In short i thought gradle template will be fine, but i see this inconvenience that make work much slower.

For assets you can use runtime files('./assets') in dependencies so it wont build them.

dependencies {

runtime files('./assets')
}
1 Like

uh i think you almost answered my question.

but i got issue:

Uncaught exception thrown in Thread[jME3 Main,5,main]
AssetNotFoundException: Asset name doesn’t match requirements.
“D:/GameProjects/InversionRoot/assets/Interface/Fonts/default.fnt” doesn’t match “Interface/Fonts/Default.fnt”

when have runtime files(’./assets’) instead of runtime project(’:assets’)

this is all i use:

apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'idea'

mainClassName='mygame.Main'

repositories {
    //This is where jme3 dependencies are stored.
    jcenter()

    maven { url "http://dl.bintray.com/jmonkeyengine/com.jme3" }
    maven { url 'https://dl.bintray.com/stephengold/jme3utilities' }
    maven { url 'https://dl.bintray.com/stephengold/org.jmonkeyengine' }

    //Uncomment this if you install local dependencies.
    //mavenLocal()

    //Uncomment this if you use external dependencies
    //mavenCentral()

    //Uncomment this if you use jme3-niftygui
    //maven{url 'http://nifty-gui.sourceforge.net/nifty-maven-repo'}

}

ext {
   jmeVersion = '[3.1,)'
}

//sourceSets {
//    main {
//        java { srcDir 'src'}
//        //resources { srcDir 'assets' }
//    }
//}    

project(":assets") {
    apply plugin: "java"

    buildDir = rootProject.file("build/assets")

    sourceSets {
        main {
            resources {
                srcDir '.'
            }
        }
    }
}

dependencies {
    
    compile "org.jmonkeyengine:jme3-core:$jmeVersion"
    compile "org.jmonkeyengine:jme3-desktop:$jmeVersion"
    compile "org.jmonkeyengine:jme3-lwjgl:$jmeVersion"
    compile 'jme3utilities:Minie:0.6.2'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    
    //Those are jme3 additional library uncomment the ones you need
    //compile "org.jmonkeyengine:jme3-android-native:$jmeVersion"
    //compile "org.jmonkeyengine:jme3-android:$jmeVersion"
    //compile "org.jmonkeyengine:jme3-bullet-native-android:$jmeVersion"
    compile "org.jmonkeyengine:jme3-blender:$jmeVersion"
    //compile "org.jmonkeyengine:jme3-bullet-native:$jmeVersion"
    //compile "org.jmonkeyengine:jme3-bullet:$jmeVersion"
    compile "org.jmonkeyengine:jme3-effects:$jmeVersion"
    //compile "org.jmonkeyengine:jme3-examples:$jmeVersion"
    //compile "org.jmonkeyengine:jme3-jogg:$jmeVersion"
    //compile "org.jmonkeyengine:jme3-jogl:$jmeVersion"
    //compile "org.jmonkeyengine:jme3-lwjgl3:$jmeVersion"
    //compile "org.jmonkeyengine:jme3-networking:$jmeVersion"
    //compile "org.jmonkeyengine:jme3-plugins:$jmeVersion"
    compile "org.jmonkeyengine:jme3-terrain:$jmeVersion"
    //compile "org.jmonkeyengine/jme3-testdata5:*"
    //You need to uncomment nifty repository in the repositories section if you use this dependency
    //compile "org.jmonkeyengine:jme3-niftygui:$jmeVersion"

    //runtime project(':assets')
    runtime files('./assets')
}

task wrapper(type: Wrapper) {
}

////autogenerowanie projektu
//task createDirs << {
//
//    def pkg = 'mygame'
//    def dirs = [
//        file("./src/main/java/$pkg"),
//        file("./src/main/resources"),
//        file("./assets/Interface"),
//        file("./assets/MatDefs"),
//        file("./assets/Materials"),
//        file("./assets/Models"),
//        file("./assets/Scenes"),
//        file("./assets/Shaders"),
//        file("./assets/Sounds"),
//        file("./assets/Textures"),
//    ]
//
//    dirs.each {
//        if( !it.exists() ) {
//            println "Creating " + it
//            it.mkdirs()
//        }
//        if( it.listFiles().length == 0 ) {
//            def stub = new File(it, 'removeme.txt')
//            println "Creating stub file to allow git checkin, file:$stub"
//            stub.text = "Remove me when there are files here."
//        }
//    }
//}

Just a blind guess,
Can you test with runtime files("assets") instead of runtime files(’./assets’)

still the same issue, but if there is some command to “include” flies into libs(not just read them) instead of jar of this files, then could solve.

anyway thanks for suggest, i tried runtime files(":assets") but also dont work.

im not sure how it was in Ant project, so when i run it just use files and when build, it build all jars.

There is a capital D in the filename but the path specifier is using a lowercase d. Are there perhaps two of those files, one with a capital D and one without?

The asset was located, though, else it would throw an AssetNotFound exception down to a FileNotFound exception.

1 Like

hmm, there is only one file, but you catch properly, that there is D and d, so maybe that is why it dont match.

edit: i just changed file name from default.fnt to Default.fnt and now i got different issue:

java.lang.IllegalStateException: The font's texture was not found!
	at com.jme3.font.BitmapTextPage.<init>(BitmapTextPage.java:74)
	at com.jme3.font.BitmapText.<init>(BitmapText.java:67)
	at com.jme3.font.BitmapText.<init>(BitmapText.java:61)
	at com.jme3.app.StatsAppState.setFont(StatsAppState.java:86)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:215)
	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)

so look like this helped, but now something else. cant find anything usefull about this error on forum

About previous issue, fact is i had myFont = assetManager.loadFont(“Interface/Fonts/Default.fnt”); in code, but looks like it was not case sensitive before. anyway now is correct

it use:
stateManager.getState(StatsAppState.class).setFont(guiFont);

where

    if (guiFont == null) {
        guiFont = app.getAssetManager().loadFont("Interface/Fonts/Default.fnt");
    }

it worked in ant project version and also when assets was in Jar(gradle), so dont know currently what is wrong.

sometines issues are really odd.

Seems like i had font, that was not loaded, but error dont popup when assets were in Jar, but now when changed to files, error popup, so fixed name, so true error appear, i just have wrong font it seems, removed it and it work :smiley:

Anyway i got next question about gradle if someone could help.

i use Nehon template, and i got error when trying to convert. Should i create somehow new project over assets? its already as graddle subproject, so if someone coul explain what is best approach to make it work, would be nice.

ooooooooopppppp

because its really fast using IDE to convert :slight_smile: dont even know different way, but anyway prefer IDE if possible(and not workarround like creating ant project with assets, then copy paste, it take much longer)

or maybe is there some way you have for fast j3o converting? and preview. IDE was best for me

Asset loading has been case sensitive for about 6 years.

Somehow when you copied the fnt and png files into your project, you lower-cased the file names I guess. The font file names must match.

1 Like

hi @pspeed i dont know why this work in old(Ant) project, anyway i still have it intact and i have there lowercase “default.fnt” and no error. (but i belive maybe some other lib added it in uppercase)

@pspeed Could you please help me with IDE asset converting when using gradle? :pray:

JME core has Interface/Fonts/Default.fnt embedded in it… so you were probably loading that one before.

I can only tell you that the case sensitivity check has been there since JME 3.0 beta3 or so.

If converting glTF to J3O works in your Ant-based project, you could convert it there and then copy it over.

Or you could write a Java utility to perform the conversion for you. Then you could add a conversion task to your gradle.build script.

The glTF importers are included in the jme3-plugins library. Here is sample code that uses the importers:

    public static void main(String[] args) {
        if (args.length < 1) {
            System.out.println("Please specify an input filepath.");
            System.exit(-1);
        }
        String inputFilePathname = args[0];
        if (!inputFilePathname.endsWith(".gltf")) {
            System.out.println("Input file doesn't have .gltf extension.");
            System.exit(-1);
        }
        String outputFilePathname = inputFilePathname.substring(0, inputFilePathname.length() - 4) + "j3o";
        System.out.printf("convert %s -> %s%n", inputFilePathname, outputFilePathname);

        AssetManager assetManager = new DesktopAssetManager();
        assetManager.registerLoader(BinLoader.class, "bin");
        assetManager.registerLoader(GltfLoader.class, "gltf");
        assetManager.registerLoader(J3MLoader.class, "j3m", "j3md");
        assetManager.registerLocator(null, ClasspathLocator.class);
        assetManager.registerLocator(".", FileLocator.class);

        ModelKey key = new ModelKey(inputFilePathname);
        Node model = (Node) assetManager.loadModel(key);

        File outputFile = new File(outputFilePathname);
        JmeExporter exporter = BinaryExporter.getInstance();
        try {
            exporter.save(model, outputFile);
        } catch (IOException exception) {
            System.out.printf("Failed while writing %s%n", outputFilePathname);
            System.exit(-1);
        }
    }
1 Like

Hmm, that would be nice if gradle would auto remove and auto re-compile but only changed gltf files.

copy files will slow my work much, i need have some quick or automatic solution(the best - but anyway need some quick fixes to scenegraph).

not sure if possible with gradle, But seen SDK had something like file watcher.(not perfect one imo, but was)

btw, i continued this question here: