I created a blender file and then converted it into the j3o file. The only way to load the 3d structure in the game is through a Spacial object:

Spatial towerModel = assetManager.loadModel("Textures/tower.j3o");

Initially the tower in the scene was composed by a simple Geometry:

new Geometry("Tower." + index, new Box(X_SIZE, Y_SIZE, Z_SIZE));

To substitute this implementation with a proper 3d tower I need to use the Gemetry object from the 3jo.

How can I extract the Geometry from the j3o file?


The Spatial given to you from the loadModel method is most likely a Node. You'll have to traverse that node's children (and possibly grand-children) to get to the Geometry, which you will have to cast from one of the child Spatials.

I've not got the code before me right now, so I can't show you, but looking at the Javadoc it should be pretty simple (a bit of recursion should help).

|improve this answer|||||
  • \$\begingroup\$ I found the way to get the geometry, but once I attach it to the scene it doesn't show up; on the contrary in the "scene composer" windows I can see it. (In the blender file there's just the mesh object, I removed the camera and the lights). \$\endgroup\$ – Fab Jan 22 '14 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.