Six degrees of freedom is the X, Y and Z axes, plus pitch, yaw and roll of the ship around said axes. When aiming, we've gotta compensate for the waves pushing the ship around.
Of course there are many other variables taken into account in a fire control solution. The ones you mentioned, distance to target, etc.
Naturally, all this stuff is done near-automagically via computer systems in combat. We Fire Controlmen just maintain, calibrate and test these systems. My system in particular is the SPY-1A radar. Without it, all our fire control systems are blind to any target's direction, distance and elevation. Pretty crucial variables when you're trying to shoot at it.