Model Clone

Im planning on cloning my Bot models so that i can have 10 on the terrain with the same abilities, im gona try use this code, just wondering if this is the right way to clone models with animations and will it affect performance?

CloneImportExport cloner = new CloneImportExport();
 for (int x=0;x<10;x++) {
              newOne = (Node) cloner.loadClone();
              newOne.setLocalTranslation(calcRandomCharacterPos( GameTest.getTerrainPage()));
              newOne.updateGeometricState(0, true);

Take a look at this !!!  :roll:

if i use this, will the bot still have animation in it and the same actions which i have defined for the Bot?

If you use the ObjectPool system example I listed, then yes.

Sorry about this but could ya give me a brief example of how this actuallt works, like in my code i have a node for the bot model and for example if im close to it it runs at me shooting, how does it determine which bot will run at me etc.?

You'd have to define that logic yourself. What I was talking about in the referenced post was simply re-usable objects.

This solves various problems:

  • Provides an abstraction from which to get instances of scene objects

  • Provides pooling so instead of creating and releasing scene objects it recycles them for better performance

  • The example references using a byte[] to generate multiple copies of a single model - essentially giving you clone functionality