Cloning models

Hi im loading a chess board model (ase) the model consists of a model for each piece and a complete model of the board trim and pieces.

I am tring to duplicate the piece models in the code so i don’t have to load the same thing twice but i seem to be having touble doing this.

i have a 2 element array and i’m tring to fill it by getting same model twice from the Emumeration as in the ase model loading tutorial, with just two duplicate calls to get(Object) from the Hashtable.

The result of this is my array has only one model reference in it the first element being null and the second containing the model, and i can’t figure out why.

Help!!

Basically you should be able to use the sharedCopy method of a (Xith) node in order to clone it. Currently I’m just using it on a 3dsloader TDSModel, which is a derivate of BanchGroup. It works fine.
For example, to create a clone of an existing BranchGroup object namend mymodel:


BranchGroup newclone = (BranchGroup) mymodel.sharedCopy(mymodel);

Alright thanks Bombadil, i’ll give it a go :slight_smile: