The idealized surfaces that can be used for cams MUST have their extruded directions parallel to each other. If curves are used, these curves must lie in the same plane in space. This comes from the fact that cams in MDX/MDO are 2D only, so this rule must be followed for cam pairs to work properly. Unfortunately, it does not seem the on-line manual or PLMS instruction points this out specifically, although 2D does infer this constraint.
If the yellow part only slides left and right, and the horizontal surface on the yellow part, in the cam definition above, is removed from the cam definition, and the vertical surfaces remaining on the yellow part's cam definition are split into two separate cams, it should work. 3D contact should work for this problem, but I've found that this option is very compute intensive.