- Home /
Problems with enemy ai
I have enemies in my game that follow the player, but they sometimes they try to walk through walls. I know that to fix this i need to use Physics2D.Linecast or Physics2D.Raycast. I need an example of code that would check if there is a 2d collider between the player and the enemy, if the only collides with the player follow would be true, else it would be false.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612150054im_/https://answers.unity.com/themes/thub/images/avi.jpg)