How to get a Transparent material to cast a shadow

Simply put for a project at university I am trying to get a material which goes transparent when the player gets between the objects with said material and the player. It’s for a dungeon crawler btw.
I have it working in that way, however I have noticed that when the objects have the material they do not cast a shadow, ever.
What am I doing wrong?
This is my details panel so you can see what I have done

Hey Birchie. Here’s a simple setup. Go to Details of your mesh and check “Volumetric Translucent Shadow”. After that the mesh should start casting shadows.

when at the play level, why do the shadows disappear?

I know this is much too late but this technique only works on masked transparency and the material still needs to be ever so slightly opaque like 1%.