in my 3dsmax scene i do have a sliding door (mesh) which i want to animate.
i added a single bone to the scene, animated it and applied a skin modifier to my door and added the bone.
i prepared a sequences.txt file:
slidingDoorOpen 0 15
slidingDoorClose 15 30
i’d done the setup for the animation:
private function onAssetComplete(event:AssetEvent):void
{
var _loc_2:Mesh = null;
var _loc_3:* = null;
//var _loc_4:AnimationN= null;
trace("loaded asset: " + "[" + event.asset.assetType + "] " + event.asset.name);
if (event.asset.assetType == AssetType.MESH)
{
_loc_2 = Mesh(event.asset);
_loc_3 = _loc_2.material as TextureMaterial;
// add events to clickable objects
asignMeshClickListener(_loc_2);
// setup special materials (glass...)
if (_loc_3)
{
if (_loc_2.material.name == "matGlass")
{
_loc_3.alpha = 0.25;
}
}
// asign local var pointers
if( event.asset.name=="house1doorFrameLeft" )
{
_mesh_house1doorFrameLeft = _loc_2;
}
}
else if (event.asset.assetType == AssetType.SKELETON)
{
if (event.asset.name == "Bone001")
{
_skeleton_bone001_animationSet = new SkeletonAnimationSet(3);
_skeleton_bone001_animator = new SkeletonAnimator(_skeleton_bone001_animationSet, event.asset as Skeleton);
}
}
else if (event.asset.assetType == AssetType.ANIMATION_NODE)
{
if (_skeleton_bone001_animationSet.animationNames.indexOf(event.asset.name)<0)
{
trace("added animation state: " + event.asset.name);
_skeleton_bone001_animationSet.addAnimation(event.asset as AnimationNodeBase);
}
}
}
private function onResourceComplete(e:LoaderEvent):void
{
_view.scene.addChild(this._loader);
// animator bindings
_mesh_house1doorFrameLeft.animator = _skeleton_bone001_animator;
//setup the render loop
addEventListener(Event.ENTER_FRAME, _onEnterFrame);
_stage.addEventListener(Event.RESIZE, onResize);
_stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
_stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
_stage.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel);
onResize();
}
private function asignMeshClickListener(loc_2:Mesh):void
{
switch (loc_2.name)
{
case "house1doorWindowLeft":
case "house1doorWindowRight":
case "house1doorFrameLeft":
case "house1doorFrameRight":
loc_2.mouseEnabled = true;
loc_2.addEventListener(MouseEvent3D.CLICK, animateHouse1Doors_doOpen);
break;
}
}
private function animateHouse1Doors_doOpen(e:MouseEvent3D):void
{
_skeleton_bone001_animator.play("slidingDoorOpen");
}
now, if my scene starts up, some other meshes which are not affected by the animation are corrupted.
the click handler works fine and the animation starts to play. but it takes the door from its position away to the 0,0,0 point of my scene and animates it there.
some other strange things:
1) the animation never stops - it should stop at frame 15!?!?
2) every animation node gets loaded twice!! i fixed this strange problem with this code:
if (_skeleton_bone001_animationSet.animationNames.indexOf(event.asset.name)<0)
{
trace("added animation state: " + event.asset.name);
_skeleton_bone001_animationSet.addAnimation(event.asset as AnimationNodeBase);
}
but is this usual???
is there a bug in the awd-exporter or i’m doing something wrong?