a NodeAnimationTrack bug?

yekehui001

05-08-2013 14:36:36

I build a skeleton like this:

this.skeleton = SkeletonManager.Singleton.Create(skeletonName, ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
Bone rootBone = skeleton.CreateBone("Root");
rootBone.ResetOrientation();
rootBone.SetBindingPose();
var t0 = (Bone)rootBone.CreateChild("Tower.0", Vector3.ZERO);
t0.ResetOrientation();
t0.SetBindingPose();
var t1 = (Bone)t0.CreateChild("Tower.1", Vector3.UNIT_Y * 12);
t1.ResetOrientation();
t1.SetBindingPose();
var t2 = (Bone)t1.CreateChild("Tower.2", Vector3.UNIT_Y * 12);
t2.ResetOrientation();
t2.SetBindingPose();
skeleton.SetBindingPose();

and build an animation for it:

Animation animation = skeleton.CreateAnimation(Constraint.AnimationName, 5);
var track = animation.CreateNodeTrack(0, skeleton.GetBone("Tower.1"));
var keyFrame1 = track.CreateNodeKeyFrame(0);
keyFrame1.Rotation = Quaternion.IDENTITY;
var keyFrame2 = track.CreateNodeKeyFrame(5);
keyFrame2.Rotation = new Quaternion(new Radian(Mogre.Math.PI / 3), Vector3.UNIT_Z);
animation.Optimise();

and then link this skeleton to a mesh, create a entity, get the AnimationState, enable it, addTime...
and at last, the bone named "Tower.0" is rotated, not the "Tower.1" I asked.
If I remove the "Root", and use "Tower.0" as the root, everything will be correctly, but unfortunate I have some other things to do with the "Root" bone so I can't simply remove it.
Is this a bug? Or I missed any importent code?