How do I get the rotation due to animation?

I am placing a cube around animated humanoids so that as the characters animate, the cube automatically resizes and recenters itself when the character walks, waves its arms, etc, so that the cube always just encloses the character at all times. The cube is a child object of the character top-level object so that it also translates and rotates as the character moves around the scene.
I place the cube so that its transform relative to the character is position =, rotation =Quaternion.Identity which means that vertices 0 - 3 face the same way as the character and I use that to do special things with that face.
All of this works perfectly as long as the animation used does not involve any rotation of the entire character, which causes the character to no longer face along the Z axis of the top level transform. If there is any such rotation, then the cube does not follow it and I can’t work out how to make it do so.

I have tried getting the rotation of the hips and applying that to the rotation of the cube but, although that does affect the starting rotation, it does not update with the animation (I am trying to apply the rotation during Update).

Can anyone tell me how I can get the current rotation due to animation in a way that will allow me to apply it to the cube during update?

Well, I solved the problem. Applying the rotation of the hips to the cube was the right approach but there are a few wrinkles.
First, the animation (from mixamo) orients the axes differently so I ended up applying the z rotation of the hips to the y rotation of the cube, then adding 180 degrees to it.
This is the actual code snippet:

            Vector3 eulerRot = hips.transform.localEulerAngles;
            boundingBox.transform.localEulerAngles = new Vector3 (0.0f, eulerRot.z+180, 0.0f);

This worked perfectly with the samba dancing animation from mixamo but the standard asset ‘walk’ animation gave nonsense results. This seems to be because that animation is not setting a rotation for the hips so it’s undefined. When I replaced it with a walking animation from mixamo, the problem was solved.

I hope this helps anyone who wants to eg: know where a character is looking when it is animated.