Rigid body formulation in a finite element context with contact interaction