private void DrawObject(GameTime gameTime, AnimatedPlayerObject animatedPlayerObject)
        {
            //    SkinnedEffect effect = animatedPlayerObject.Effect as SkinnedEffect;
            //an array of the current positions of the model meshes
            Matrix[] bones = animatedPlayerObject.AnimationPlayer.GetSkinTransforms();
            Matrix   world = animatedPlayerObject.GetWorldMatrix();

            for (int i = 0; i < bones.Length; i++)
            {
                bones[i] *= world;
            }

            foreach (ModelMesh mesh in animatedPlayerObject.Model.Meshes)
            {
                foreach (SkinnedEffect skinnedEffect in mesh.Effects)
                {
                    skinnedEffect.SetBoneTransforms(bones);
                    skinnedEffect.View       = (this.Game as Main).CameraManager.ActiveCamera.View;
                    skinnedEffect.Projection = (this.Game as Main).CameraManager.ActiveCamera.ProjectionParameters.Projection;

                    // skinnedEffect.Texture = animatedPlayerObject.Texture;
                    skinnedEffect.DiffuseColor = animatedPlayerObject.Color.ToVector3();
                    skinnedEffect.Alpha        = animatedPlayerObject.Alpha;
                    skinnedEffect.EnableDefaultLighting();
                    skinnedEffect.PreferPerPixelLighting = true;
                }
                mesh.Draw();
            }
        }
        private void DrawObject(GameTime gameTime, AnimatedPlayerObject animatedPlayerObject, Camera3D activeCamera)
        {
            //an array of the current positions of the model meshes
            Matrix[] bones = animatedPlayerObject.AnimationPlayer.GetSkinTransforms();
            Matrix   world = animatedPlayerObject.GetWorldMatrix();

            for (int i = 0; i < bones.Length; i++)
            {
                bones[i] *= world;
            }

            foreach (ModelMesh mesh in animatedPlayerObject.Model.Meshes)
            {
                foreach (SkinnedEffect skinnedEffect in mesh.Effects)
                {
                    skinnedEffect.SetBoneTransforms(bones);
                    skinnedEffect.View       = activeCamera.View;
                    skinnedEffect.Projection = activeCamera.Projection;

                    //if you want to overwrite the texture you baked into the animation in 3DS Max then set your own texture
                    if (animatedPlayerObject.EffectParameters.Texture != null)
                    {
                        skinnedEffect.Texture = animatedPlayerObject.EffectParameters.Texture;
                    }

                    skinnedEffect.DiffuseColor = animatedPlayerObject.EffectParameters.DiffuseColor.ToVector3();
                    skinnedEffect.Alpha        = animatedPlayerObject.Alpha;
                    skinnedEffect.EnableDefaultLighting();
                    skinnedEffect.PreferPerPixelLighting = true;
                }
                mesh.Draw();
            }

#if DEBUG
            debugDrawCount++;
#endif
        }