Unwanted rotating

I know this topic has come up before but i have not found an answer to the problem. I load the model fine from 3ds, the texture and materals are all there. But the problem is that the object is rotated 90 degrees to the right… I would prefer to not have to rotate every object i load 90 degrees. Can someone please tell me if there is something wrong with the code.



public static Node loadModel (String modelFile){

Node loadedModel = null;

FormatConverter formatConverter = null;

ByteArrayOutputStream BO = new ByteArrayOutputStream();

String modelFormat = modelFile.substring(modelFile.lastIndexOf(".") + 1, modelFile.length());

String modelBinary = modelFile.substring(0, modelFile.lastIndexOf(".") + 1) + "jbin";

URL modelURL = ModelLoader.class.getClassLoader().getResource(modelBinary);

System.out.println("If");

//verify the presence of the jbin model

if (modelURL == null){



modelURL = ModelLoader.class.getClassLoader().getResource(modelFile);



//evaluate the format

if (modelFormat.equals("3DS")){

formatConverter = new MaxToJme();

} else if (modelFormat.equals("md2")){

formatConverter = new Md2ToJme();

} else if (modelFormat.equals("md3")){

formatConverter = new Md3ToJme();

} else if (modelFormat.equals("ms3d")){

formatConverter = new MilkToJme();

} else if (modelFormat.equals("ase")){

formatConverter = new AseToJme();

} else if (modelFormat.equals("obj")){

System.out.println("OBJ");

formatConverter = new ObjToJme();

}

formatConverter.setProperty("mtllib", modelURL);



try {

formatConverter.convert(modelURL.openStream(), BO);

loadedModel = (Node) BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));



//save the jbin format

BinaryExporter.getInstance().save(loadedModel, new File(modelBinary));

} catch (IOException e) {

e.printStackTrace();

return null;

}

}else{

try {

//load the jbin format

loadedModel = (Node) BinaryImporter.getInstance().load(modelURL.openStream());

} catch (IOException e) {

return null;

}

}

return loadedModel;

}

iIf someone could please help me that would be fantastic.

Can someone please tell me if there is something wrong with the code.


No, its simply the modeller using another coordinate system / default facing than jme.

If You set the local rotation of the node or trimesh You get from the loader there should really be no overhead besides the inconvenience.

Other then that You could make an utility that rotates it and saves it back or grab a 3ds capable modeller, open the model and rotate it by hand.

Please do not cross-post:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=5875