AI rotation

Hello everyone.
I’m having a problem figuring out how the rotate my AI towards where it’s moving. I’m having it move to a random location. But lets say that that location is behind a huge wall that it has to go around. Then my AI will always be facing the point. And not where it’s actually going. Is there a way to detect rotation based on movement?

This hasn’t worked for me, but I read online that making the agent radius in project settings to be the same as your npc radius will do the trick. but im also stumped on this matter