Author Topic: Object3d.cloneObject() doesn't copy Animation  (Read 5254 times)

Offline DarthAPO

  • byte
  • *
  • Posts: 4
    • View Profile
    • http://www.darthapo.com
Object3d.cloneObject() doesn't copy Animation
« on: December 12, 2002, 05:23:08 am »
It seems that the Object3D.cloneObject() doesn't clone the AnimationSequence.

 I worked around the issue by copying the Animation from the Original Object3D to the Cloned Object3D. Something like this:

Code: [Select]
Object3D origObj = Loader.loadMD2( sModelPath, fScale );
Object3D retObj;

retObj = origObj.cloneObject();
retObj.setAnimationSequence( origObj.getAnimationSequence() );


 Is that the way it was planned to work? If not, are there any issues in using this method as a work around? I think that they will be sharing the same Animation Sequence data -- but that doesn't seem bad.

Thanks,
 M@

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Object3d.cloneObject() doesn't copy Animation
« Reply #1 on: December 12, 2002, 06:00:05 pm »
Yes, you are right. I think that i'll add this in a way similar to your workaround to the next release. Anyway, the operation (cloning of animated objects) as a whole is a little questionable. A cloned object (A') uses the same Mesh as the object it has been cloned from (A). In case of animated objects, this will cause A' to perform the same animation as A and vice versa, because the same Mesh will be manipulated from within both objects. This behaviour is mentioned in the documentation of the getMesh()-method in Object3D.
If this is a bug or a feature...you decide... :D In some cases, the behaviour can be exactly what one wants and in some other cases, it's exactly what you don't want. If you don't want it, try to add
Code: [Select]
retObj.setMesh(origObj.getMesh().cloneMesh(Mesh.COMPRESS)); right after you've cloned the object. That should make it use the same animation data (which is a good idea) but perform the animation on a different Mesh.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Object3d.cloneObject() doesn't copy Animation
« Reply #2 on: January 20, 2003, 11:54:09 pm »
0.83 beta 1 is out and hopefully fixes this flaw as well as some others.
Look here for more info: http://www.jpct.net/forum/viewtopic.php?t=19

Offline DarthAPO

  • byte
  • *
  • Posts: 4
    • View Profile
    • http://www.darthapo.com
Object3d.cloneObject() doesn't copy Animation
« Reply #3 on: January 20, 2003, 11:57:49 pm »
Excellent! I'll give it a go, thanks.

Offline eye1

  • int
  • **
  • Posts: 68
    • View Profile
Object3d.cloneObject() doesn't copy Animation
« Reply #4 on: October 04, 2006, 04:09:22 pm »
Hello

Can you tell me what is actually cloned with call cloneObject?

Octree is??