Hi,
i got a little issue with loading animated models, i spent a lot of time to solve it by myself but without successful result. Here is the thing :
I got the lastest away4d, and 3dsmax exporter. Here is the code how i load the model with animation :
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, OnAssetComplete);
AssetLibrary.load(new URLRequest("test.AWD"),null ,null,new AWD2Parser());
private function OnAssetComplete(e:AssetEvent):void
{
switch (e.asset.assetType)
{
case AssetType.SKELETON:
trace("loaded skeleton");
animation = new SkeletonAnimation(e.asset as Skeleton, 3, true);
mesh.animationState = new SkeletonAnimationState(animation);
mesh.geometry.animation = animation;
animator = new SmoothSkeletonAnimator(SkeletonAnimationState(mesh.animationState));
break;
case AssetType.MESH:
trace("loaded mesh");
var submesh:Mesh = e.asset as Mesh;
submesh.material = new ColorMaterial(356);
mesh.addChild(submesh);
break;
case AssetType.ANIMATION:
trace("loaded animation");
seq= e.asset as SkeletonAnimationSequence;
seq.name = e.asset.name;
animationsNames.push(seq.name);
animator.addSequence(seq);
break;
case AssetType.ANIMATOR:
trace("loaded animator");
break;
case AssetType.CONTAINER:
trace("loaded container");
break;
case AssetType.ENTITY:
trace("loaded entity");
break;
case AssetType.GEOMETRY:
trace("loaded geometry");
break;
case AssetType.MATERIAL:
trace("loaded material");
break;
case AssetType.SKELETON_POSE:
trace("loaded skeletonpose");
break;
case AssetType.TEXTURE:
trace("loaded texture");
break;
default:
trace("error")
break;
}
}
I dont have any models in 3ds max made by myself, i download some animated free models. Some of these models right after export in preview act very strange like :
instead of one object of model there are 2 or the the skeleton is under the model etc…
In my code model loaded successfuly except for bugs which i metion above and when i want to play animation nothing happen.
Please help me someone, i dont know if i made a mistakes when i creating models or when i loading them.
Ondrej