/// <summary>
            /// Assign this bone to the correct bone in the model
            /// </summary>
            /// <param name="model"></param>
            public void SetModel(MyCharacter model)
            {
                if (ClipBone == null)
                {
                    return;
                }

                // Find this bone
                int index;

                m_assignedBone = model.FindBone(ClipBone.Name, out index);

                if (ClipBone.Name == model.Definition.SpineBone)
                {
                    CalculateSpineAdditionalRotation = true;
                }
                else
                {
                    CalculateSpineAdditionalRotation = false;
                }

                if (ClipBone.Name == model.Definition.HeadBone)
                {
                    CalculateHeadAdditionalRotation = true;
                }
                else
                {
                    CalculateHeadAdditionalRotation = false;
                }

                //"l_Forearm") || (ClipBone.Name == "r_Forearm"))
                if ((ClipBone.Name == model.Definition.LeftForearmBone) || (ClipBone.Name == model.Definition.RightForearmBone))
                {
                    CalculateHandAdditionalRotation = true;
                }
                else
                {
                    CalculateHandAdditionalRotation = false;
                }

                if (ClipBone.Name == model.Definition.LeftUpperarmBone)
                {
                    CalculateUpperHandAdditionalRotation = 1;
                }
                else
                if (ClipBone.Name == model.Definition.RightUpperarmBone)
                {
                    CalculateUpperHandAdditionalRotation = -1;
                }
                else
                {
                    CalculateUpperHandAdditionalRotation = 0;
                }
            }
        public void Initialize(AnimationPlayer player)
        {
            m_clip           = player.Clip;
            m_model          = player.Model;
            m_weight         = player.Weight;
            m_timeScale      = player.m_timeScale;
            m_justFirstFrame = player.m_justFirstFrame;

            m_boneCount = player.m_boneCount;
            if (m_boneInfos == null || m_boneInfos.Length < m_boneCount)
            {
                m_boneInfos = new BoneInfo[m_boneCount];
            }


            Position = player.Position;
            Looping  = player.Looping;

            for (int b = 0; b < m_boneCount; b++)
            {
                if (m_boneInfos[b] == null)
                {
                    m_boneInfos[b] = new BoneInfo();
                }
                // Create it
                m_boneInfos[b].ClipBone = player.m_boneInfos[b].ClipBone;
                m_boneInfos[b].Player   = this;

                // Assign it to a model bone
                m_boneInfos[b].SetModel(m_model);
                m_boneInfos[b].CurrentKeyframe = player.m_boneInfos[b].CurrentKeyframe;
                m_boneInfos[b].SetKeyframes();
                m_boneInfos[b].SetPosition(Position);

                if (MyFakes.ENABLE_BONES_AND_ANIMATIONS_DEBUG)
                {
                    int index;
                    System.Diagnostics.Debug.Assert(m_model.FindBone(m_boneInfos[b].ClipBone.Name, out index) != null, "Can not find clip bone with name: " + m_boneInfos[b].ClipBone.Name + " in model: " + m_model.Name);
                }
            }


            m_initialized = true;
        }
            /// <summary>
            /// Assign this bone to the correct bone in the model
            /// </summary>
            /// <param name="model"></param>
            public void SetModel(MyCharacter model)
            {
                if (ClipBone == null)
                    return;

                // Find this bone
                int index;
                m_assignedBone = model.FindBone(ClipBone.Name, out index);

                if (ClipBone.Name == model.Definition.SpineBone)
                    CalculateSpineAdditionalRotation = true;
                else
                    CalculateSpineAdditionalRotation = false;

                if (ClipBone.Name == model.Definition.HeadBone)
                    CalculateHeadAdditionalRotation = true;
                else
                    CalculateHeadAdditionalRotation = false;

                 //"l_Forearm") || (ClipBone.Name == "r_Forearm"))
                if ((ClipBone.Name == model.Definition.LeftForearmBone) || (ClipBone.Name == model.Definition.RightForearmBone))
                    CalculateHandAdditionalRotation = true;
                else
                    CalculateHandAdditionalRotation = false;

                if (ClipBone.Name == model.Definition.LeftUpperarmBone) 
                    CalculateUpperHandAdditionalRotation = 1;
                else
                    if (ClipBone.Name == model.Definition.RightUpperarmBone)
                    CalculateUpperHandAdditionalRotation = -1;
                else
                    CalculateUpperHandAdditionalRotation = 0;
            }
        public void Initialize(AnimationPlayer player)
        {
            m_clip = player.Clip;
            m_model = player.Model;
            m_weight = player.Weight;
            m_timeScale = player.m_timeScale;
            m_justFirstFrame = player.m_justFirstFrame;

            m_boneCount = player.m_boneCount;
            if (m_boneInfos == null || m_boneInfos.Length < m_boneCount)
                m_boneInfos = new BoneInfo[m_boneCount];


            Position = player.Position;
            Looping = player.Looping;

            for (int b = 0; b < m_boneCount; b++)
            {
                if (m_boneInfos[b] == null)
                    m_boneInfos[b] = new BoneInfo();
                // Create it
                m_boneInfos[b].ClipBone = player.m_boneInfos[b].ClipBone;
                m_boneInfos[b].Player = this;
                    
                // Assign it to a model bone
                m_boneInfos[b].SetModel(m_model);
                m_boneInfos[b].CurrentKeyframe = player.m_boneInfos[b].CurrentKeyframe;
                m_boneInfos[b].SetKeyframes();
                m_boneInfos[b].SetPosition(Position);

                 if (MyFakes.ENABLE_BONES_AND_ANIMATIONS_DEBUG)
                 {
                     int index;
                     System.Diagnostics.Debug.Assert(m_model.FindBone(m_boneInfos[b].ClipBone.Name, out index) != null, "Can not find clip bone with name: "+m_boneInfos[b].ClipBone.Name+" in model: " + m_model.Name );
                 }
            }


            m_initialized = true;
        }