Constraints. You can add “hinge” constraints to your box either inside the physics asset editor, or with the physics constrain component. When you add a constraint it will have a lot of settings you can mess with. The ones that are probably going to be the most important to you would be the angular limits and anular motor. You will also need to specify what constraint names and bones you want to effect.
Another component you might want to look into would be the physical animation component. Which can control how much physics is effecting animations.
There is a lot of settings in both of these components, so I’d recommend watching some tutorials on how to use them.