Bypassing obstacles and tracking enemies

Sorry for the repost, I forgot to tag ‘Learning Agent’.

I used raycast to store the distance from the wall.

I penalized the agent when it is facing the wall and when it touches the wall.
Here are the rewards

They recognized the walls and try to avoid approaching it.

But I intended for them to bypass the wall to get to the enemy, but they just stood still and stared at the invisible enemy on the other side of the wall.

Here’s the video.

How can i get the agents to bypass walls ??

Thank you.