private NewPlayerMovement playerMovement;
    private Animator animator;
    
    Vector3 playerVelocity;

    [SerializeField, Range(.1f, .5f)]
    float velocityThreshHold;

    float speed, maxSpeed;

    Vector2 inputs;

    private bool started;

    private void Awake()
    {
        playerMovement = GetComponentInParent<NewPlayerMovement>();
        animator = GetComponent<Animator>();
    }

    void Update()
    {
        //Make sure that the string is named exactly as the paramter in the animator controller!!
        //Vector3 forwardAxis = playerMovement.GetForwardDirection(); //hopefully this gives the forward direction..
        //Debug.Log("player velocity:" + playerVelocity);
        //float yVelocity = playerVelocity.y;
        //playerVelocity.y = 0;
        //Debug.Log("playervelocity" + playerVelocity + "yVelocity: " + yVelocity);
        inputs = playerMovement.GetSpeedAndInputs(out speed, out maxSpeed);
        float speedProportion = maxSpeed / 100;
        float speedPercentage = speed * speedProportion;

        animator.SetBool("Jump", playerMovement.DesiredJump);
        if (inputs.magnitude > 0.1f)
        {
            animator.SetFloat("MoveSpeed", speed);
            animator.SetFloat("MoveSpeedPercentage", speedPercentage);
        }
        else
        {
            animator.SetFloat("MoveSpeed", 0);
            animator.SetFloat("MoveSpeedPercentage", 0);
        }

    }

    private void LateUpdate()
    {
        UpdateLookDirection();
    }    
    

    private void UpdateLookDirection()
    {
        //Vector3 upAxis = CustomGravity.GetUpAxis(transform.position);
        //transform.rotation = Quaternion.LookRotation(playerMovement.GetLookDirection(), upAxis);
        if (!playerMovement.OnGround)
        {
            Vector3 forwardDirection = playerMovement.GetForwardAxis();
            Vector3 upAxis = playerMovement.UpAxis;

            Quaternion rotation = Quaternion.LookRotation(forwardDirection, upAxis);
            //rotation.Normalize();
            rotation.x = 0f;
            transform.rotation = rotation;
        }
        else if (inputs.magnitude > velocityThreshHold && !playerMovement.DesiredJump)
        {
            Vector3 forwardDirection = playerMovement.GetForwardAxis();
            Vector3 upAxis = playerMovement.UpAxis;

            Quaternion rotation = Quaternion.LookRotation(forwardDirection, upAxis);
            //rotation.Normalize();
            transform.rotation = rotation;
        }

    }