Author Topic: Mesh not importing with Ardor3D  (Read 1652 times)

Offline hubbardh

  • byte
  • *
  • Posts: 4
    • View Profile
Mesh not importing with Ardor3D
« on: February 25, 2013, 06:41:54 am »
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:

Code: [Select]
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:
Code: [Select]
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

Offline hubbardh

  • byte
  • *
  • Posts: 4
    • View Profile
Re: Mesh not importing with Ardor3D
« Reply #1 on: February 25, 2013, 08:14:58 am »
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

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: Mesh not importing with Ardor3D
« Reply #2 on: February 25, 2013, 03:41:00 pm »
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
Code: [Select]
chmod +x scripts/ardorCollada2Bones.sh
i would suggest Ogre3D format instead of Collada