Hi,
I’m having a weird problem whem loading several animated meshes into the game…
Here’s the code called on ASSET_COMPLETE:
private function onMD5ResourceComplete($e:AssetEvent):void
{
var node:SkeletonClipNode;
var animator:SkeletonAnimator;
var asset:IAsset = $e.asset;
var name:String = asset.assetNamespace;
var animation_set:SkeletonAnimationSet;
LightLogger.log("onMD5ResourceComplete " + name + " " + asset.assetType);
if (asset.assetType == AssetType.ANIMATION_SET)
{
animation_set = asset as SkeletonAnimationSet;
animator = new SkeletonAnimator(animation_set, _md5Meshes[name].skeleton);
_md5Meshes[name].mesh.animator = animator;
_md5ReadyRope.cutFiber(name);
}
else if (asset.assetType == AssetType.SKELETON)
{
if(_md5Meshes[name] == null)
_md5Meshes[name] = {};
_md5Meshes[name].skeleton = asset as Skeleton;
}
else if (asset.assetType == AssetType.MESH)
{
if(_md5Meshes[name] == null)
_md5Meshes[name] = {};
_md5Meshes[name].mesh = asset as Mesh;
_md5Meshes[name].mesh.castsShadows = true;
}
}
And here’s the logged result:
onMD5ResourceComplete Sleepy.md5mesh geometry
onMD5ResourceComplete Sleepy.md5mesh mesh
onMD5ResourceComplete Sleepy.md5mesh skeleton
onMD5ResourceComplete Sleepy.md5mesh animationSet
onMD5ResourceComplete Angry.md5mesh geometry
onMD5ResourceComplete Angry.md5mesh mesh
onMD5ResourceComplete Angry.md5mesh skeleton
onMD5ResourceComplete Angry.md5mesh animationSet
[Fault] exception, information=Error: A Material instance cannot be shared across renderables with different animator libraries
Thanks in advance.