In previous works, discrete mechanics and optimal control for constrained systems (DMOCC) has been introduced for the structure preserving simulation of optimal control problems for rigid multibody systems, whereby possible contacts or collisions between the bodies have been disregarded. In the formulation presented here, both collision avoidance as well as explicitly planned collisions between non-smooth bodies are included. To this end, a subdifferentiable global contact detection algorithm, the supporting separating hyperplane linear program (SSHLP), based on the signed distance between supporting hyperplanes of two convex sets, is used in the simulation of optimal control problems. (© 2012 Wiley-VCH Verlag GmbH & Co. KGaA, Weinheim)