On the numerical solution of many-body dynamics problems formulated as complementarity problems