Obj reading error

Hi all, i find a strange error using test: TestObjJmeWrite.

The error is a java.lang.ClassCastException: com.jme.scene.TriMesh

The obj model is exported from max to try loading it.

In 3ds all works fine except for textures, loaded but not smooted!

Any suggestion?

Thanks, Achille.

The importers give You either a node or a TriMesh depending on Your model so You best cast what You get to a spatial.


What you can do, is create a Node to contain the TriMesh returned by the loader:

            Node n = new Node("trimesh");
            n.attachChild( (TriMesh)BinaryImporter.getInstance().load(new ByteArrayInputStream(output.toByteArray())) );

I try to cast to a TriMesh, but it return objects in it?

For example, if i import a 3ds i find dummy and meshes as spatial by using :

for (Spatial child : model.getChildren()) System.out.println(child);

Now i have used Collada for testing and importing Camera also… unique problem is get material using the getModel() method…  :?