Mesh not importing with Ardor3D

Started by hubbardh, February 25, 2013, 06:41:54 AM

Previous topic - Next topic

hubbardh

My current operating system, Ubuntu, won't let me run the script to convert .dae files to .bones files, so i decided to make a converter myself here's what I have so far:

import java.io.File;
import java.io.FileOutputStream;
import java.net.URI;

import raft.jpct.bones.AnimatedGroup;
import raft.jpct.bones.BonesIO;
import raft.jpct.bones.BonesImporter;
import raft.jpct.bones.Quaternion;

import com.ardor3d.extension.model.collada.jdom.ColladaImporter;
import com.ardor3d.extension.model.collada.jdom.data.ColladaStorage;
import com.ardor3d.util.resource.ResourceLocatorTool;
import com.ardor3d.util.resource.SimpleResourceLocator;

public class Main {
public static void main(String[] args) throws Exception {
File Spectre = new File("./res/guyidle.dae");
URI uri = Spectre.toURI();
final SimpleResourceLocator resLocater = new SimpleResourceLocator(uri.resolve("./"));
        ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_MODEL, resLocater);
ColladaImporter Col = new ColladaImporter().loadTextures(false);
ColladaStorage Stor = Col.load(uri.toString());
AnimatedGroup A3D = BonesImporter.importCollada(Stor, 1, new Quaternion());
BonesIO.saveGroup(A3D, new FileOutputStream("res/guyidle.bones"));
}

}


but whenever i run the code i get this: Exception in thread "main" java.lang.RuntimeException: Unable to load collada resource from URL: URLResourceSource [url=file:/home/hubbardh/workspace/Dae%20To%20Bones/res/guyidle.dae, type=.dae]
at com.ardor3d.extension.model.collada.jdom.ColladaImporter.load(ColladaImporter.java:154)
at com.ardor3d.extension.model.collada.jdom.ColladaImporter.load(ColladaImporter.java:91)
at Main.main(Main.java:22)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 4
at com.ardor3d.extension.animation.skeletal.SkinnedMesh.applyPose(SkinnedMesh.java:264)
at com.ardor3d.extension.model.collada.jdom.ColladaAnimUtils.buildSkinMeshes(ColladaAnimUtils.java:486)
at com.ardor3d.extension.model.collada.jdom.ColladaAnimUtils.buildController(ColladaAnimUtils.java:157)
at com.ardor3d.extension.model.collada.jdom.ColladaNodeUtils.getVisualScene(ColladaNodeUtils.java:115)
at com.ardor3d.extension.model.collada.jdom.ColladaImporter.load(ColladaImporter.java:134)
... 2 more


I think it either has something to do with the shape of the character or the fact that it was exported from blender. Please help

hubbardh

i was able to figure it out i just had to change one of the bone's names to root and make it the parents of all the bones in the model

raft

Quote from: hubbardh
My current operating system, Ubuntu, won't let me run the script to convert .dae files to .bones files

I'm also using Ubuntu. what is the probem with script file? just make it executable
chmod +x scripts/ardorCollada2Bones.sh

i would suggest Ogre3D format instead of Collada