I am using AssetManager
to load an OBJ file (and its respective MTL) and am getting the following stacktrace:
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.ClassCastException: com.jme3.asset.AssetKey cannot be cast to com.jme3.asset.TextureKey
at com.jme3.texture.Texture.setKey(Texture.java:425)
at com.jme3.scene.plugins.MTLLoader.loadTexture(MTLLoader.java:186)
at com.jme3.scene.plugins.MTLLoader.readLine(MTLLoader.java:232)
at com.jme3.scene.plugins.MTLLoader.load(MTLLoader.java:304)
<rest omitted for brevity>
My full repo and all source code can be found here (if interested) and to run it all you need to do is run ./gradlew run
, however the code of interest is this snippet from SampleApp
:
public class SampleApp extends SimpleApplication {
public static void main(String[] args) {
new SampleApp().start();
}
@Override
public void simpleInitApp() {
Spatial spatial = assetManager.loadModel("house-ext-front/corrected.obj");
rootNode.attachChild(spatial);
...
}
}
I created these OBJ/MTL files by loading a .blend
file in Blender and exporting it as Wavefront/OBJ format. Any ideas as to what is happening here?