protected virtual void DebugAttributes()
        {
            //CharacterDebug.Log("Moving", Moving);
            //CharacterDebug.Log("Grounded", Grounded);

            CharacterDebug.Log("seperator", "----------");
            CharacterDebug.Log("RelativeInputVector", RelativeInputVector);
            CharacterDebug.Log("InputVector", InputVector);

            //CharacterDebug.Log("m_Velocity", m_Velocity);
            //CharacterDebug.Log("m_MoveDirection", m_MoveDirection);


            //CharacterDebug.Log("rb_AngularVelocity", m_Rigidbody.angularVelocity);
            //CharacterDebug.Log("rb_Velocity", m_Rigidbody.velocity.y);
        }
        /// <summary>
        /// Move charatcer based on input values.
        /// </summary>
        protected virtual void Move()
        {
            if (InputVector.sqrMagnitude > 1)
            {
                InputVector.Normalize();
            }
            RelativeInputVector = m_Transform.TransformDirection(InputVector);

            //m_DeltaYRotation = 0;

            m_Velocity      = RelativeInputVector;
            m_MoveDirection = m_Velocity * m_DeltaTime;



            float turnAngle = 0;

            switch (m_MovementType)
            {
            case (MovementType.Adventure):

                var   direction   = Mathf.Abs(InputVector.z) > 0 ? InputVector.x : -InputVector.x;
                float targetAngle = Mathf.Atan2(direction, Mathf.Abs(InputVector.z));

                targetAngle     *= Mathf.Rad2Deg * m_RotationSpeed;
                m_DeltaYRotation = Mathf.SmoothDampAngle(m_DeltaYRotation, targetAngle, ref m_RotationSmoothDamp, 0.15f);
                //CharacterDebug.Log("targetAngle", targetAngle);
                break;

            case (MovementType.Combat):
                Vector3 localDir = m_Transform.InverseTransformDirection(LookDirection);
                m_DeltaYRotation = Mathf.Atan2(localDir.x, localDir.z) * Mathf.Rad2Deg * m_RotationSpeed;
                //m_DeltaYRotation = Mathf.SmoothDampAngle(m_DeltaYRotation, targetAngle, ref m_RotationSmoothDamp, 0.15f) * m_RotationSpeed;
                break;
            }

            Vector3 axisSign = Vector3.Cross(LookDirection, m_Transform.forward);

            turnAngle = Vector3.Angle(m_Transform.forward, LookDirection) * (axisSign.y >= 0 ? -1f : 1f);

            CharacterDebug.Log("m_DeltaYRotation", m_DeltaYRotation);
            CharacterDebug.Log("turnAngle", turnAngle);


            Moving = Mathf.Abs((m_Rigidbody.position - m_PreviousPosition).sqrMagnitude) > 0;
            m_Rigidbody.angularDrag = InputVector.sqrMagnitude > 0 ? 0.05f : m_Mass;
        }
        /// <summary>
        /// Update the character’s rotation values.
        /// </summary>
        protected virtual void UpdateRotation()
        {
            //if (InputVector == Vector3.zero)
            //    m_DeltaYRotation *= (1.01f - (Mathf.Abs(m_DeltaYRotation) / 180)) * m_IdleRotationMultiplier;
            m_DeltaYRotation  = (float)Math.Round(m_DeltaYRotation, 2);
            m_DeltaYRotation *= m_RotationSpeed * m_DeltaTime;
            Quaternion targetRotation = Quaternion.AngleAxis(m_DeltaYRotation, m_Transform.up);


            float   angleInDegrees;
            Vector3 rotationAxis;

            targetRotation.ToAngleAxis(out angleInDegrees, out rotationAxis);
            rotationAxis.Normalize();
            Vector3 angularDisplacement = rotationAxis * angleInDegrees * m_RotationSpeed; // (Mathf.Sign(rotationAxis.y * angleInDegrees))

            m_Rigidbody.angularVelocity = angularDisplacement;



            //if (m_Grounded){
            //    Vector3 d = transform.position - m_Animator.pivotPosition;
            //    m_Rigidbody.MovePosition(m_Animator.pivotPosition + m_LookRotation * d);
            //}
            m_Rigidbody.MoveRotation(targetRotation * m_Transform.rotation);

            CharacterDebug.Log("rbAngularVel_spd", m_Rigidbody.angularVelocity.magnitude);
            CharacterDebug.Log("rbAngularVel", m_Rigidbody.angularVelocity);

            CharacterDebug.Log("angularDisplacement", angularDisplacement);
            CharacterDebug.Log("angleInDegrees", angleInDegrees);
            CharacterDebug.Log("rotationAxis", rotationAxis);



            //if (m_UseRootMotion)
            //{
            //    float angleInDegrees;
            //    Vector3 rotationAxis;
            //    m_Animator.deltaRotation.ToAngleAxis(out angleInDegrees, out rotationAxis);
            //    Vector3 angularDisplacement = rotationAxis * angleInDegrees * Mathf.Deg2Rad * m_RotationSpeed;
            //    m_Rigidbody.angularVelocity = angularDisplacement;

            //    CharacterDebug.Log("angularDisplacement", angularDisplacement);
            //}
        }
        protected void OnActionActive(CharacterAction action, bool activated)
        {
            int index = Array.IndexOf(m_Actions, action);

            if (action == m_Actions[index])
            {
                if (m_Actions[index].enabled)
                {
                    if (activated)
                    {
                        //Debug.LogFormat(" {0} is starting.", action.GetType().Name);
                        CharacterDebug.Log(action.GetType().Name, action.GetType());
                    }
                    else
                    {
                        CharacterDebug.Remove(action.GetType().Name);
                    }
                }
            }
        }