A method for the numerical integration of mechanical systems with unilateral constraints: study of impact in multibody systems