Kinda hard to explain. I know you can get the sun's position from Lighting. So I'd imagine you would use that to get this effect. But I guess I can explain it as using the object as where to simulate the sun's position from the player's view, though it wouldn't be where it really is.
Here is an image to help explain: https://imgur.com/a/FkKL3AO