How do I get a sharedcopy of a TDSModel?

I’m storing several models that will be used frequently in a HashMap. From this, I need to be able to get a sharedcopy TDSModel so that all the new models will be able to use use TDSModel’s animation feature. So far, I can’t seem to figure out a way to do this, and frequently am running into class casting problems.

This is bits and pieces of what I use, hope you can understand it…

(Snippet from Class modelCache) —
private HashMap models;

/**
 * Load a 3DS File
 * @param modelName
 * @return
 */
public TDSModel loadTDSModel(String modelName) {
    if (models.get(modelName) == null) {
        try {
            TDSModel model = new TDSLoader().load(modelName,true);
            models.put(modelName, model);
        }
        catch (Exception e) {
            e.printStackTrace();
                    System.out.println("3DS Model " + modelName + " could not be loaded! Exiting!");
                    System.exit(0);
                    return null;
        }            
    }
    
    return (TDSModel) models.get(modelName);        
}

(Snippet from Actor class) ----
private Shape3D s;
private Appearance a;
private BranchGroup model;

public void init(String modelName) {
    if (modelName.endsWith("obj")) {
       model = world.getModelCache().loadOBJModel(modelName);
    } else if (modelName.endsWith("3ds")) {
        model = world.getModelCache().loadTDSModel(modelName);
        //s = (Shape3D) ((TransformGroup) model.getChild(0)).getChild(0);
        //a = s.getAppearance();
    }

    tgRot.addChild(model.sharedCopy());
    group.addChild(tgRot);        
    //group.setShowBounds(true, true);
    world.addTransformGroup(group);
    world.addActor(this);
}

========

TDSModel extends BranchGroup. So you can do shared copy on the BranchGroup and add it to other transform groups. etc etc.