Support Forum

Making enemy stop once within a certain radius of the player

Hello! I just tried implementing A* for the first time and I wrote my own code for it (just very basic pathfinding with seeker). the only problem I have right now is that the enemy keeps moving/walking even when literally next to the player (and starts pushing them). how would I go about making the enemy stop when within a certain radius and continue again if the player would move out of this radius?

And how do I implement a way that enemies only start chasing the player if they have vision on them AND the player is in a certain radius? (in case of large rooms)

thanks! (I’m new to unity in general so I hope the question isn’t too dumb haha)

EDIT: I also have another problem apparently. My enemies just get stuck on basic walls? They just keep running into it… (also just found out it only happens when i have simple smooth enabled? (default settings))

afbeelding

afbeelding