clone meshes and it animation

Software: Away3D 4.x

Yuliy, Newbie
Posted: 14 September 2011 08:26 PM   Total Posts: 4

used MD5Mesh
...
controller = new SkeletonAnimator(SkeletonAnimationState(basePers.animationState));

....

When I clone mesh:

sourceMesh = Mesh(basePers.clone());

I can’t control animation separate.

call: controller.play(“go”) for basePers and sourceMesh play too.

try: sourceMesh.animationState = basePers.animationState.clone(); - no helped
I think problem in same sourceMesh.geometry.animation and basePers.animation, but how create animations from mesh: basePers ?

   

Yuliy, Newbie
Posted: 14 September 2011 08:55 PM   Total Posts: 4   [ # 1 ]

and cann’t load same mesh with animations twice… what a f..

   

Avatar
Alejandro Santander, Administrator
Posted: 15 September 2011 06:22 PM   Total Posts: 414   [ # 2 ]

Running some tests, will reply soon…

   

Yuliy, Newbie
Posted: 15 September 2011 07:06 PM   Total Posts: 4   [ # 3 ]

I can send code(my demo), if it helps. ..

   

Avatar
Alejandro Santander, Administrator
Posted: 15 September 2011 08:17 PM   Total Posts: 414   [ # 4 ]

Just tried this and mesh clones come with an animation state clone within them. You can however reset their animation state to that of the original mesh, resulting in all clone animations playing at the same time.

This should not be so though and has been filed as an issue in github.

Thanks!

   

Avatar
kurono, Sr. Member
Posted: 23 October 2011 02:10 AM   Total Posts: 103   [ # 5 ]

Also the same problem… :( How to reset ( = null) or completely remove animations from mesh container?
mesh.geometry.animation.removeOwner(mesh) didn’t helped.

   

Avatar
sebbdk, Jr. Member
Posted: 09 November 2011 11:22 PM   Total Posts: 39   [ # 6 ]

Did you find out how to reset the animationstate?
working on working around this issue just now smile

   

MegaManSE, Newbie
Posted: 21 November 2011 09:38 PM   Total Posts: 12   [ # 7 ]

I am having the same problem, please let me know how to do it if either of you figure it out…

- Will

   

MegaManSE, Newbie
Posted: 23 November 2011 12:36 AM   Total Posts: 12   [ # 8 ]

Maybe it has something to do with that SkeletonAnimationState when it clones uses the same _skinnedAnimation as the original or when the mesh is cloned, the clone has the same geometry as the original.  Still looking…

   

MegaManSE, Newbie
Posted: 28 November 2011 09:35 PM   Total Posts: 12   [ # 9 ]

Had to mod the Away3D engine to get it to work, hopefully this gets fixed up in the near future.  Unfortunately my mod requires the geometry to be copied for each instance :(

In Mesh.as clone method

var clone : Mesh = new Mesh(_materialgeometry.clone()); 

SkeletonAnimationSequence.as also needs a clone method:

public function clone():SkeletonAnimationSequence
  {
   
var s:SkeletonAnimationSequence = new SkeletonAnimationSequence(name_additive);
   
s._frames _frames;
   
s._rootPos _rootPos;
   
s._rootDelta _rootDelta;
   
s._durations _durations;
   
s._totalDuration _totalDuration;
   
s._fixedFrameRate _fixedFrameRate;
   
s.looping looping;
   return 
s;
  

Cheers,
- Will

   

MegaManSE, Newbie
Posted: 28 November 2011 09:36 PM   Total Posts: 12   [ # 10 ]
   

evevanan, Newbie
Posted: 02 December 2011 09:06 PM   Total Posts: 7   [ # 11 ]

Thanks, MegaManSE, for this useful tip!

   

zoxx, Newbie
Posted: 06 January 2012 01:27 PM   Total Posts: 10   [ # 12 ]

could you post complete solution?

tried modification of Mesh.as and SkeletonAnimationSequence.as but it doesn’t work

   

MegaManSE, Newbie
Posted: 06 January 2012 08:32 PM   Total Posts: 12   [ # 13 ]

This is how I cloned it correctly, where c is a clone object that contains a clone of the mesh and animation:

c.mesh mesh.clone() as Mesh;
   
   var 
m:BitmapMaterial = new BitmapMaterial(diffuse);
   
m.gloss data.material.gloss;
   
m.specular data.material.specular_exponent;
   if (
normalm.normalMap normal;
   if (
specularm.specularMap specular;
   
c.mesh.material m;
     
   
c.animator = new SmoothSkeletonAnimator(SkeletonAnimationState(c.mesh.animationState));
   
c.animator.updateRootPosition false;
   
c.animator.timeScale 1;
   
   for 
each (var sequence:SkeletonAnimationSequence in animationSequences)
   
{
    
var s:SkeletonAnimationSequence sequence.clone();
    
c.animator.addSequence(s);
    
s.addEventListener(AnimatorEvent.SEQUENCE_DONEc.animationDone);
   
   

MegaManSE, Newbie
Posted: 06 January 2012 08:36 PM   Total Posts: 12   [ # 14 ]

These are the variables from the original animated model used above:

public var mesh:Mesh;
private var 
diffuse:BitmapData;
private var 
specular:BitmapData;
private var 
normal:BitmapData;
private var 
material:BitmapMaterial;  
private var 
animator:SmoothSkeletonAnimator;
private var 
animationSequences:Vector.<SkeletonAnimationSequence>; 
   

zoxx, Newbie
Posted: 08 January 2012 09:34 AM   Total Posts: 10   [ # 15 ]

I do the same

Humans=new Array();
   for( var 
i=0i<10i++){
    Humans[i]
=new Object();
    
    
//Humans[i].icon=new Cylinder(mat_ball,2.5,2.5,17);    
    //Humans[i].icon=new Mesh(mat_human,md5Mesh.geometry.clone());
    
Humans[i].icon=md5Mesh.clone() as Mesh;
    
//Humans[i].icon.mouseEnabled=true;   
    
Humans[i].icon.rotationX=90;
    
Humans[i].icon.scaleX=0.32;
    
Humans[i].icon.scaleY=0.32;
    
Humans[i].icon.scaleZ=0.32;    
    
Humans[i].icon.z=12;    
    
Humans[i].animcontrol_icon=new SmoothSkeletonAnimator(SkeletonAnimationState(Humans[i].icon.animationState));
    var 
seq:SkeletonAnimationSequence md5Anim.clone();
    
Humans[i].animcontrol_icon.addSequence(seq);
    
Humans[i].animcontrol_icon.frame=500;
    
Humans[i].animcontrol_icon.play("anim");    
    
//Humans[i].icon.addEventListener(MouseEvent3D.MOUSE_DOWN , onoverHuman);
    
view.scene.addChild(Humans[i].icon);    
   
}

where

private var md5Mesh:Mesh;
  private var 
md5Anim:SkeletonAnimationSequence

but noticed that something wrong is with animationState, when I put there copied, disapears object (Humans\[i\].icon.animationState), of course it works with md5Anim.animationState but than all objects have same animation.

Haven’t you added some animationState coping to mesh clone?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X