Connecting Pipes at points

I am going through building pipe placing functionality and trying to find a good simple way of place pipes in the correct connected side of another pipe. Right now I am kind of figuring out a way of determining position and rotation based on the pipe it is connecting to but there are so many different types of pipes and angles.

Is there a good way of doing this with a hinge? Kind of snap one pipe to another at a specific location on the pipes. (I have child empty objects that mark the pipe connection locations).

I am open to other ideas.

I’ve done something similar with hingeJoints in the past. You can use connectedBody to determine what the pipe is attached to. Use connectedAnchor to determine the attachment position. Then you can useLimits to drive the joint to a specific angle.

In some cases you have to disable the rigidbody before you move it and enable it afterwards. Otherwise the physics engine has kittens.