Adding a shadow on a cloned character makes the characters share the same animation

Software: Away3D 4.x

Alex Bogartz, Sr. Member
Posted: 04 January 2012 06:15 PM   Total Posts: 216

I filed this on GitHub, but it’s very strange.

Steps:

Load an MD5 animation and create controllers for each one using a clone:

(Zombie class is just an extended ObjectContainer3D)

for (var i:int = 0; i < totalZombies; i++)
{
var newZombie:Mesh = Mesh(zombieMesh.clone());

newZombie.castsShadows = false;
var zombie:Zombie = new Zombie();
zombie.animator = new SmoothSkeletonAnimator(newZombie.animationState as SkeletonAnimationState); zombie.positi Vector3D(totalZombies*100 - (i * 50), 10, -400+Math.random()*100);
zombie.animator.timeScale = 2.3 + (Math.random()*3);
zombie.mesh = newZombie;

scene.addChild(zombie);
zombies.push(zombie);
}

Change the castsShadows to true.

Observe that the clones now share the same animations and cannot be controlled separately.

This drove me crazy for hours, since I couldn’t understand why my characters were all suddenly sharing the same animation sequences.  By carefully copying and pasting the code from an earlier version I saw that the castsShadows line was the culprit.  Any ideas on this?

   

Avatar
Apprentice, Jr. Member
Posted: 20 January 2012 01:29 PM   Total Posts: 45   [ # 1 ]

I’m “happy” to read this. I just discovered I had the same problem.
Luckily I discovered it quite quickly as I touched my shadow off/on button and saw the animations were suddenly independent again.

What’s “funny” is if you assign animation A to Mesh C (which is a clone of MeshSrc) and assign animation B to Mesh D (also a clone of MeshSrc) then they start playing the same animation (like you said), but the shadow is showing the proper animations.

I guess for now I won’t have copied animating meshes cast shadows.

—Apprentice

   

Alex Bogartz, Sr. Member
Posted: 20 January 2012 05:33 PM   Total Posts: 216   [ # 2 ]

Thanks, glad to see I’m not crazy!  Hopefully one of the developers will pop in and let us know if there’s something we’re doing wrong of if it’s a valid bug.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X