Cloned Mesh with different animators

Software: Away3D 4.x

nurdoganerdem, Newbie
Posted: 08 January 2014 09:59 AM   Total Posts: 3

Hi,

My target is to display 4 animations of the same mesh, at the same time with 2 different animation states (walk and idle).

What i found out yet:
- If i just clone the mesh with mesh.clone(), the SkeletonAnimator (and its SkeletonAnimationSet and Skeleton) will also be cloned. This will give me the possibility to play different animation states, but cloned SkeletonAnimators are bad for performance. I got 6 FPS here…
- If i just clone the mesh with mesh.clone(), and reference only 1 SkeletonAnimator to all meshes i am getting 30FPS, but i can’t play different animation states.

So my approach was to create an individual SkeletonAnimator for each mesh, with a reference to only 1 SkeletonAnimationSet and 1 Skeleton.

First i created the SkeletonAnimator, SkeletonAnimationSet and the animation nodes.

private function onAssetComplete(eventAssetEvent): void {
   
if (event.asset.assetType == AssetType.MESH{
    protoMesh 
event.asset as Mesh;
   
else if (event.asset.assetType == AssetType.ANIMATION_NODE{
    
var animationNodeSkeletonClipNode event.asset as SkeletonClipNode;
                
skeletonAnimationSet.addAnimation(animationNode);
   
else if (event.asset.assetType == AssetType.SKELETON{
    
    skeletonAnimationSet 
= new SkeletonAnimationSet();
    
skeletonAnimator = new SkeletonAnimator(skeletonAnimationSetevent.asset as Skeleton);
   
}
  } 

Then i cloned the mesh and added an individual Animator for each cloned mesh, sharing the same SkeletonAnimationSet and Skeleton.

var clonedMesh:Mesh protoMesh.clone() as Mesh;
clonedMesh.animator = new SkeletonAnimator(skeletonAnimationSetskeletonAnimator.skeleton); 

I started the application and I got this error:
A Material instance cannot be shared across renderables with different animator libraries

Ok, i tried a different way…instead of cloning the mesh, i cloned the geometry and assigned a new texture

var clonedMesh:Mesh = new Mesh(protoMesh.clone(), new TextureMaterial(TextureMaterial(protoMesh.material).texture)); 

Now, the animation works but is incredibly slow. I get 6 FPS with a weird looking texture.

My Question is, what is the correct workflow to display 4 animations of the same mesh with different animation states and a good performance?

   

nurdoganerdem, Newbie
Posted: 08 January 2014 02:48 PM   Total Posts: 3   [ # 1 ]

Ok, i think i got the solution. It looks like that the animation i have used had more than 32 bones, which forces Away3D to do the calculation on the CPU.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X