Unable to load multiple models

I have two different .obj model files, but whenever I try to load them both, jME ignores the second one and creates and exact copy of the first one, seemingly without loading the second one. Is this a known bug or am I doing something wrong code-wise?



EDIT: Materials are not copied, just the model itself.

1.where did you place those 2 models ? may be they are already loaded and are on the same place and you can see only one

2.and if you copied the code, may be the codes are the same and you load the first one 2 times ?

3. have you rootNode.attachchild the second one ?


Here's the code I use for my tests.

public void simpleInitApp() {
        ModelKey key1 = new ModelKey("Models/highElf.obj");
        ModelKey Key2 = new ModelKey("Models/highElfFemale.obj");

        Spatial model1 = (Spatial) assetManager.loadModel(key1);
        model1.updateModelBound();
        Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
        mat1.setColor("m_Color", ColorRGBA.Blue);
        model1.setMaterial(mat1);
       
        Spatial model2 = (Spatial) assetManager.loadModel(Key2);
        model2.updateModelBound();
        Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
        mat2.setColor("m_Color", ColorRGBA.Red);
        model2.setMaterial(mat2);

        rootNode.attachChild(model1);
        rootNode.attachChild(model2);

        model1.move(0, 1.5f, 0);


When I run this I get two copies of "highElf.obj," one is blue and the other one is red.

I dont see any error in your code (it doesnt mean that your code doesnt have error ^^there might still be error somewhere)

so I dont know either. may be when you exported them, you forgot to export the female one and exported the male one 2 times and both of them are the same with different names ?

It's not that I accidentally exported the male model twice, because if I have jME set key2 before key1 both will use the female model. Maybe it's a flaw in the way the assetManager works?



EDIT: After making two separate classes that load the model by themselves, both show up and render perfectly fine.

I think I found the issue. The OBJ loader fails when attempting to load more than 1 model, instead it will re-use old data.

I fixed the issue. Please update from SVN.

what a scary error ^^

I think I will try to load some model with ogrexml to check if there are the same error there^^

ogre can load at least 2 model without any error ^^

can also have at least 2 animation at the same time ^^