public PlayerStateHangingOnLedge(PlayerInputScript player, GameObject go)
    {
        pi    = player;
        ledge = go;
        //Ensure that the player is rotated facing the ledge
        Quaternion r = ledge.GetComponent <LedgeScript>().GetRotation();
        Transform  t = pi.playerScript.GetPlayerTransform();

        t.eulerAngles = new Vector3(t.eulerAngles.x, r.eulerAngles.y - 90, t.eulerAngles.z);
        //Turn off gravity so that the player doesn't fall
        pi.gameObject.GetComponent <Rigidbody>().useGravity = false;
        Debug.Log("Hanging on ledge state");
        //Freeze the player so that they don't rotate or move while hanging on the ledge
        pi.GetRigidbody().constraints = pi.GetFreezeAll();
        //Player cannot jump until they stop pressing the jump input
        canJump = false;
    }