Duplicating Spatials

Hello,

I'm new to JME and I've recently came accross one problem.



I'm trying to write a simple logic game. I have several types of objects made in Blender and exported to *.obj file.

Each of them is saved in a different file.

I intend to build the whole scene usinge those objects, so each of them will be drawn many times.



And here my problem begins. I was trying to load only one instance of an object to memory and then draw it many times.

I attach the object to a node and display the node to the scene. But it happens that the object is being rendered only in the last node I created.

Is it possible to render one instance of Spatial several times ?



If not then is there a way to copy a Spatial. Reading one object hundred times from a file takes quite a long time.



I'm working with NetBeans 6.5

My version of Blender is 2.48a.



Best regards,

Kaelthas

just curious:

shouldnt each object have its own node? therefore, what about node.clone()?

You could use a SharedNode, see jmetest.renderer.TestSharedNode



Or use BinaryImporter/Exporter to clone your models, see jmetest.util.TestExporter

Well a Node has a list of children (other nodes or meshes). And a child can only be attached to one parent Node.

And Node has no clone() method.

Thanks a lot for help.



SharedNode solved the problem  :slight_smile: