Object3d.cloneObject() doesn't copy Animation

Started by DarthAPO, December 12, 2002, 05:23:08 AM

Previous topic - Next topic

DarthAPO

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:

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@

EgonOlsen

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
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.

EgonOlsen

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

DarthAPO


eye1

Hello

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

Octree is??