I often use something like this:
[java]
public <T extends Savable> T cloneSavable(T t) {
try {
ByteArrayOutputStream outputstream = new ByteArrayOutputStream();
BinaryExporter.getInstance().save(t, outputstream);
ByteArrayInputStream in = new ByteArrayInputStream(
outputstream.toByteArray());
BinaryImporter b = new BinaryImporter();
b.setAssetManager(assetManager);
return (T) b.load(in);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
[/java]
It works fine and I dont have to write custom clone logic when I already implemented the Savable logic. Maybe this could be added as a similar static method to the spatial class?