Models with more than one mesh in JMonkeyEngine

Posted by Andrea Tucci on Game Development See other posts from Game Development or by Andrea Tucci
Published on 2012-09-02T18:11:05Z Indexed on 2012/09/02 21:49 UTC
Read the original article Hit count: 226

I’m a new jmonkey engine developer and I’m beginning to import models. I tried to import simple models and no problems appeared, but when I export some obj models having more than one mesh in the OgreXML format, Blender saves multiple meshes with their own materials (e.g. one mesh for face, another for body etc). Can I export all the meshes in one? I’ve tried to join all the meshes to a major one with blender (face joins body), but when I export the model and then create the Spatial in jme(loading the path of the “merged” mesh), all the meshes that are joined to the major doesn’t have their materials!

I give a more clear example:

I have an .obj model with 3 meshes and I export it. I have :

mesh1.mesh.xml , mesh2.mesh.xml , mesh3.mesh.xml and their materials

mesh1.material, mesh2.material mesh3.material

so I import the folder in Assets/Models/Test and now I have to create something like:

Spatial head = assetManager.loadModel( [path] ); 
Spatial face = assetManager.loadModel( [path] )

one for each mesh and than attach them to a common node. I think there is a way to merge those mesh maintaining their materials! What do you think? Thanks

© Game Development or respective owner

Related posts about models

Related posts about blender