Hi,
I’m writing because I have a strange behaviour with Away3D 4.1 Alpha, when using Skeleton.
My purpose with this animation is very simple, it’s just to have an animated character moving over a plane. I can have the character moving as I want, but the problem is that the plane is moving as well! The plane was added as a child of the scene, the animated mesh is a child of a class “Character”, itself child of the scene :
public class Character extends ObjectContainer3D {
... vars ...
public function Character() {
_assetBundle = AssetLibrary.getBundle("character");
_stateTransition = new CrossfadeTransition(0.5);
if (!_assetBundle.getAsset("mesh")) {
_assetBundle.addEventListener(AssetEvent.ASSET_COMPLETE, on_assetComplete);
//load the resource if it's not available
_assetBundle.load(new URLRequest("3Dobj/character.md5mesh"));
}
_state = 0;
visible = false;
name = "PlayerCharacter";
}
private function on_assetComplete(e:AssetEvent):void {
trace("AssetComplete:", e.asset.assetType, e.asset.name, e.asset.assetNamespace);
switch(e.asset.assetType) {
case AssetType.ANIMATION_NODE:
var clipNode:SkeletonClipNode = e.asset as SkeletonClipNode;
clipNode.name = clipNode.assetNamespace;
_animationSet.addAnimation( clipNode );
//idle by default
if (clipNode.name == IDLE_ANIM) {
_animator.play(IDLE_ANIM, _stateTransition);
visible = true;
}
break;
case AssetType.ANIMATION_SET:
_animationSet = e.asset as SkeletonAnimationSet;
_animator = new SkeletonAnimator(_animationSet, _skeleton);
_assetBundle.load(new URLRequest("3Dobj/walk.md5anim"), null, WALK_ANIM);
_assetBundle.load(new URLRequest("3Dobj/idle.md5anim"), null, IDLE_ANIM);
_mesh.animator = _animator;
break;
case AssetType.SKELETON:
_skeleton = e.asset as Skeleton;
break;
case AssetType.MESH:
_mesh = e.asset as Mesh;
addChild(_mesh);
break;
}
}
}
The scene setup :
var scene:Scene3D = new Scene3D();
var camera:Camera3D = new Camera3D(new PerspectiveLens(26.609));
camera.position = new Vector3D(100, 100, 100);
camera.lookAt(new Vector3D(0, 0, 0));
var view:View3D = new View3D(scene, camera);
view.backgroundColor = 0x123456;
view.width = 640;
view.height = 480;
viewContainer.addChild(view);
Loader3D.enableParser(MD5MeshParser);
Loader3D.enableParser(MD5AnimParser);
var character:Character = new Character();
scene.addChild(character);
var ground:Mesh = new Mesh(new PlaneGeometry(100, 100));
scene.addChild(ground);
I attached a picture where you can see the scene without animation (_mesh.animator = _animator; commented), and with animation. As you’ll notice, the model and the plane are rotated (they should not!), and both are animated (only the character should be)! :/
I also attached my exported model and animation, perhaps there’s something wrong with them. Do you have any clue on what is going on? Thank you for your help.