How to drag box with fixed angle?

So my player has movement based on camera direction. All works fine.
I want to be able to push and pull boxes around. So my script is:

public void BoxInteract()
    {
        if (Input.GetMouseButton(0))
        {
            hit.collider.transform.parent = this.transform;

            float vertical = Input.GetAxisRaw("Vertical");
            Vector3 direction = new Vector3(0f, 0f, vertical).normalized;
            transform.Translate(direction * Time.deltaTime, Space.Self);
}

Works fine, I can push forward and pull -forward. But, if my player is slightly rotated, the direction will be rotated as well.

I want to only push and pull on fixed angles (0º, 90º, 180º, -90º). How can I do that?

I tried making the player children of the box, it almost worked, the box moved correct, but then I can only move forward and -forward relative to the box rotation, I need the move relative to the player’s forward and -forward.

That’s because you’re translating in the player’s local (self) space:

transform.Translate(direction * Time.deltaTime, Space.Self);

You might want to use world space instead:

transform.Translate(direction * Time.deltaTime, Space.World);

If you’re unsure what this “space” stuff means, read up about vector spaces/reference frames. Understanding them is essential not just to use Unity, but to make games at all!