Changing material on specific instanced static meshes when overlapped by ball

I’ve found the answer in another forum post:

They’ve used hierarchical static meshes but it also works for instanced static meshes. It still needs a bit of fine tuning but the effect is there.

Code for reference: