Hi, I'm just the ordinary jMonkey newb, trying to import a model in the scene and it doesn't work… Don't think it's the model itself since I've also tried with bike.3ds from jmetest package and still nothing…
Here's my code, I'm basically at helloModelLoader tutorial trying to change it to import my own model, so far I've only been able to get Maggie in;
String res = "com/jmedemos/3dm-Anita.3ds";
URL model = HelloModelLoadingV2.class.getClassLoader().getResource(res);
FormatConverter converter = new MaxToJme();
converter.setProperty("mtllib", model); //Not so sure what happens if I remove this, the texture is in the 3ds anyways.
ByteArrayOutputStream bo = new ByteArrayOutputStream();
try {
converter.convert(model.openStream(), bo); //NPE location.
Node mymesh = (Node) BinaryImporter.getInstance().load(new ByteArrayInputStream(bo.toByteArray()));
//micsorarea meshului
mymesh.setLocalScale(.1f);
mymesh.setModelBound(new BoundingSphere());
mymesh.updateModelBound();
//rootnode
rootNode.attachChild(mymesh);
} catch (IOException e) {
logger.logp(Level.SEVERE, this.getClass().toString(),"simpleInitGame()", "Exception", e);
System.exit(0);
}
It gives NPE pointing at the line first line below try "converter.convert(model.openStream()...";
Thanks in advance!!
Arbaces