public override void Update(GameTime gameTime)
        {
            _debugRenderer.Clear();

            if (_avatarPose == null)
            {
                // Must wait till renderer is ready. Before that we do not get skeleton info.
                if (_avatarRenderer.State == AvatarRendererState.Ready)
                {
                    // Create AvatarPose.
                    _avatarPose = new AvatarPose(_avatarRenderer);

                    // A 'bone transform' is the transformation of a bone relative to its bind pose.
                    // Bone transforms define the pose of a skeleton.

                    // Rotate arm of avatar.
                    SkeletonPose skeletonPose  = _avatarPose.SkeletonPose;
                    int          shoulderIndex = skeletonPose.Skeleton.GetIndex("ShoulderLeft");
                    skeletonPose.SetBoneTransform(shoulderIndex, new SrtTransform(QuaternionF.CreateRotationZ(-0.9f)));

                    // The class SkeletonHelper provides some useful extension methods.
                    // One is SetBoneRotationAbsolute() which sets the orientation of a bone relative
                    // to model space.
                    // Rotate elbow to make the lower arm point forward.
                    int elbowIndex = skeletonPose.Skeleton.GetIndex("ElbowLeft");
                    SkeletonHelper.SetBoneRotationAbsolute(skeletonPose, elbowIndex, QuaternionF.CreateRotationY(ConstantsF.PiOver2));

                    // Draw avatar skeleton for debugging.
                    _debugRenderer.DrawSkeleton(skeletonPose, _pose, Vector3F.One, 0.02f, Color.Orange, true);
                }
            }
        }
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;

            // Change rotation angle.
            if (_moveArmDown)
            {
                _upperArmAngle -= 0.3f * deltaTime;
            }
            else
            {
                _upperArmAngle += 0.3f * deltaTime;
            }

            // Change direction when a certain angle is reached.
            if (Math.Abs(_upperArmAngle) > 0.5f)
            {
                _moveArmDown = !_moveArmDown;
            }

            // Get the bone index of the upper arm bone.
            var skeleton      = _meshNode.Mesh.Skeleton;
            int upperArmIndex = skeleton.GetIndex("L_UpperArm");

            // Define the desired bone transform.
            SrtTransform boneTransform = new SrtTransform(QuaternionF.CreateRotationY(_upperArmAngle));

            // Set the new bone transform.
            var skeletonPose = _meshNode.SkeletonPose;

            skeletonPose.SetBoneTransform(upperArmIndex, boneTransform);

            // The class SkeletonHelper provides some useful extension methods.
            // One is SetBoneRotationAbsolute() which sets the orientation of a bone relative
            // to model space.
            int handIndex = skeleton.GetIndex("L_Hand");

            SkeletonHelper.SetBoneRotationAbsolute(skeletonPose, handIndex, QuaternionF.CreateRotationX(ConstantsF.Pi));
        }