Hi all,
After reading the docs, I’m still a little confused about the structure of nodes/geometries/meshes in my scene, and would appreciate some advice!
In Blender, I’ve created an Empty (called “Sites”) and made it the parent of 3 objects (called “Site1-3”) and named the mesh of each object S1, S2, S3, as in the picture below…
http://i1047.photobucket.com/albums/b480/CookieJonathan/nav.gif
I load the scene into my JME SimpleApplication, and attach only the “Sites” node to the rootNode, like so…
[java]
// Load scene and attach “Sites”
gameLevel = assetManager.loadModel(“Scenes/test/test.j3o”);
siteNode = ((Node)gameLevel).getChild(“Sites”);
rootNode.attachChild(siteNode);
[/java]
When the user clicks an object, I want to get the name of the object that was clicked…
[java]
rootNode.getChild(“Sites”).collideWith(ray, results);
for (int i = 0; i < results.size(); i++) {
trace("* " + results.getCollision(i).getGeometry().getName());
trace("* " + results.getCollision(i).getGeometry().getParent().getName());
trace("* " + results.getCollision(i).getGeometry().getParent().getParent().getName());
trace("* " + results.getCollision(i).getGeometry().getParent().getParent().getParent().getName());
}
[/java]
This yields…
[java]
- s3-geom-1
- s3-ogremesh
- s3-entity
- Site3
[/java]
…which is not what I expected.
So, my questions…
- It seems that every object in Blender, when imported to JME, is added as a Node which in turn contains a Geometry… with two more levels of objects (“entity” and “ogremesh”) in between. Is that right? 4 objects from Node → Geometry? Do all Geometries have to be added to their own individual Nodes? And what exactly is the “ogreMesh” and “entity”? I understood all objects were either “Nodes” or “Geometries”. What am I missing?
- Why is the ogre importer munging the names of my meshes (i.e. adding “-geom-1”, “ogremesh” and “entity”), and is there anything I can do to preserve the names assigned in my Blender scene?
- Am I going about this all wrong? If I want to have a series of items which exist purely to be clicked on (and return the name of the clicked item), should I be arranging my scene in a completely different way to reduce the amount of objects in my scene graph, and if so, how?
Confused.
Thanks in advance for any advice!
Jon.