The neuromechanical control of Caenorhabditis elegans head motor behavior in a 3D environment