You can use a spherical joint to rotate two bodies about a common point and about all axes (arbitrary directions).
An example of a spherical joint is a tie rod.