Rotate door around pivot with physics

I want to rotate a door around its pivot with a hinge joint behavior. The thing is, and I know it’s picky, I don’t want to use Unity’s hinge joint, because it slightly shifts the position of the object when rotating. Since the pivot is already set to the object’s side, I was just wondering if there was a way to take advantage of that. Thanks.

You can set its center of mass to its origin with

rigidbody.centerOfMass = Vector3.zero; // this is local space center of mass

Then freeze xyz translation and lock x and z rotation, and it should remain fixed and only be able to rotate around the Y axis

158032-rotation-lock.png

You might have to recalculate its inertia tensor though, in case the swinging looks and behaves wonky when hitting other objects though!