im having a problem with my MS3D model loader, it keeps giving a null pointer exception, my model loader is for an animated model that walks, can anyone see whats wrong with it, thanks
ok, i have changed the code around, i dont understand, it works for a 3ds models but not for an MS3D model, the error given now is that the file cannot be opened, the path is correct, did anyone have a problem with this? could there be a problem with how i have saved my animated model? I have included the code below
public static Node loadModel() {
FormatConverter milktojme = new MilkToJme(); //the converter
Node node = null; //Where to dump mesh.
ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
milktojme.setProperty("texdir","character/zombie/");//For loading the raw file
// File Path for the model (dump file in toplevel of classpath)
//InputStream is=null;
try {
milktojme.convert(url.openStream(), bytearrayoutputstream);
//is=url.openStream();
} catch(Exception err) {
System.out.println("Could not open Model file: "+err);
}
try {
// Converts the file into a jme usable file
// milktojme.convert(is, bytearrayoutputstream);
// Used to convert the jme usable file to a TriMesh
BinaryImporter binaryImporter = new BinaryImporter();
ByteArrayInputStream in=new ByteArrayInputStream(bytearrayoutputstream.toByteArray());
//importer returns a Loadable, cast to Node
node = (Node)binaryImporter.load(in);
} catch(Exception err) {
System.out.println("Error loading md3 model:"+err);
}
// attach node to scene graph
//node.updateRenderState();
return node;
}
Ok, i got it working, just the model is on its side, would i have to do the same for 3ds and rotate it on its side in the 3d max application, has anyone had this prop?
i'm very new to jme and i have a similar problem: my model loads including animation but without texture. after hours of searching in the forum I'm a bit frustrated right now. Could you post your solution please?
Besides: 3ds uses a bit a different coordinate System, so you have to translate your model after you loaded it (how this works in jme, i can't tell you yet, sorry).
The MD5 loading contrib package has a method in there to rotate the loaded models up to the proper position, however I don't remember what it is off hand. I'll let you know later today if someone hasn't already answered or you didn't grab it out of the contrib CVS. It's a fairly simple method, but details escape me.