Object intersection material change?

This might work. Thanks.

Any idea how to get this to function with a translucent material on the second object? It doesn’t seem to recognize the object if it has transparency.