How to detect mesh intersections in a material?

I would like to do exactly what’s done in the example for Distance to Nearest Surface except I need it to be usable on all object types.

Basically, I have a plane that’s attached to the player pawn. When that plane intersects with the environment, static meshes, or other pawns, I want to have an “outline” appear.

Again, my desired result is exactly what’s in that example, I just need something that will work on everything.