Get a Copy from a MD5 Node with its assigned Controller using MD5Importer


I want to copy a MD5 Node and its assigned

Controller using the MD5Importer package for JME2!

How do I do that?

I already have the MD5Node and the assigned MD5Controller with the animations loaded.

MD5Node enemy= getEnemy().clone;

Doing that does not work, because the controller get lost.

I dont want to load the controller in every Copy again.


Maybe you can get the animations of the controller, clone them and add them to a new controller. Then add that new controller to the cloned Node.

IMD5Node player2 = VisualCtrl.modelLibrary.get("dummy").clone();

controller = VisualCtrl.getControllerCopy("dummy", player2);


public static MD5Controller getControllerCopy (String name, IMD5Node node) {

MD5Controller controller = new MD5Controller(node);

MD5Controller controllerOLD = controllerLibrary.get(name);

Collection<IMD5Animation> animations= controllerOLD.getAnimations();

for(IMD5Animation anim : animations){



return controller;

I need something better than that, because there are a lot

of copies of equal information (mesh and anim data)

-> that sucks