TUT - Double Collision
Double ray-collision to stick to a surface.

Follow up:
The Ray-Collision-node is very practical to stick objects to irregular surfaces.
The collision will be detected between two "ray points" (null objects) above and under the surface. The node outputs the distance from the bottom point.
Now this simple setup is good enough for most situation but it doesn't give you the direction of the detected point.

Now duplicate the setup and offset it from the first one and put a target expression on the resulting detection. The result is a null that points to the first detection point and thus is in the direction of the surface.

It is probably easier to follow the above setup than to read my explanation.
3 comments
The result of the script looks fantastic. I want to put many objects on each other without penetration (object sticked to surface of other object).
I'm testing cinema 4d, i not experienced with the program. Can i download the above example?
Is it easy to put my own objects in the script?
Greets, Arnout