Loading .obj files?

followed tutorial “HelloModelLoading” and got this error:



SEVERE: Exception in game loop

java.lang.ClassCastException: com.jme.scene.TriMesh cannot be cast to com.jme.scene.Node

        at HelloModelLoading.simpleInitGame(HelloModelLoading.java:49)

        at com.jme.app.BaseSimpleGame.initGame(Unknown Source)

        at com.jme.app.BaseGame.start(Unknown Source)

        at HelloModelLoading.main(HelloModelLoading.java:31)

May 4, 2008 8:40:23 PM com.jme.app.BaseSimpleGame cleanup

INFO: Cleaning up resources.

May 4, 2008 8:40:23 PM com.jme.app.BaseGame start

INFO: Application ending.

Well I don't know the example BUT…



A tri mesh is not a node, its a Spatial.



These sorts of questions can be easily answered by consulting the Javadoc.

Check out also this thread: http://www.jmonkeyengine.com/jmeforum/index.php?topic=7850.0



I believe you may be facing a similar situation - you are just loading a model with 1 material that will be loaded as a trimesh as opposed to Maggie who has several materials and will be loaded as a Node.

Mindgamer said:

Check out also this thread: http://www.jmonkeyengine.com/jmeforum/index.php?topic=7850.0


Thank you! That solved it. However, it looks like shit! Yay!!!

Sooo I'm using FreeWorld3D to map. I need advice on how I should import it. I would LIKE to have it look in game exactly like it does in FreeWorld3D. If anybody has experience with using FreeWorld3D and JME, please help me.

If you haven't used it, it looks like I can export my terrain as heightmaps (which I don't want to do) or I can export into OBJ, XML, or Ogre3D. Any idea which of these are loadable into JME and which would make it look as good as it does in FreeWorld3D?

Here's a screenshot...
Screenshot Link

I have no experience with FreeWorld3D. Looking at the image you provided, it seems very nice. However the world is quite large and I cannot imagine how the importers would handle it - would they be able to break it up into smaller pieces for culling and performance benefits, or would you have to do it yourself in your editor.



Anyways Your best choices would be either OBJ or Ogre XML. OBJ importer is ready in jME code. Ogre XML importer is being developed atm by Momoko_fan. Here is a link to the SVN: Ogre XML

Here is also a thread where Momoko describes the importer abit.



The Ogre XML format should be much more powerful and flexible, however it is not completely implemented yet. I am sure Momoko_fan would give you hint on how to solve the possible shortcoming though. Also - perhaps you could even help him out developing the format :wink:



PS: if XML means Collada then there is an importer for that also… but since its an extensive format, and not every feature is implemented in jME, it might not work for you

Mindgamer said:

I have no experience with FreeWorld3D. Looking at the image you provided, it seems very nice. However the world is quite large and I cannot imagine how the importers would handle it - would they be able to break it up into smaller pieces for culling and performance benefits, or would you have to do it yourself in your editor.

Anyways Your best choices would be either OBJ or Ogre XML. OBJ importer is ready in jME code. Ogre XML importer is being developed atm by Momoko_fan. Here is a link to the SVN: Ogre XML
Here is also a thread where Momoko describes the importer abit.

The Ogre XML format should be much more powerful and flexible, however it is not completely implemented yet. I am sure Momoko_fan would give you hint on how to solve the possible shortcoming though. Also - perhaps you could even help him out developing the format ;)

PS: if XML means Collada then there is an importer for that also... but since its an extensive format, and not every feature is implemented in jME, it might not work for you


That world is only 64x64. I had generated water that covers up where the land doesn't exist and put a skybox in the background.