Does anyone know how this Illusion works?

Does anyone know how this works?

Good luck on your adventure

Does anyone know how i could script this? Do I have to use raycasting or something else?

its either done with viewportframes, or more likely dynamicimages, along with some projection math