What do you want to achieve?
The NPC that I have made, a monster that patrols around the area, is supposed to move from one point to the other using PathFindingService.
The monster will avoid the walls in its way and reach the green points. The point to which the monster moves is set at random after each iteration of the while loop.
What is the issue?
The monster runs fairly well for most part. But quite frequently it keeps getting stuck around corners and doesn’t move for a few seconds. It sometimes even runs into walls.
A line of code was added to help the monster in case it runs into walls/corners. However, that line of code does not run, indicating that it is the path created by PathFindingService that makes it run into walls and corners.
What solutions have you tried so far?
I started to try fix it by increasing AgentRadius param of pathParams. Even after increasing it to quite a large value as 15, it kept hugging the wall. I kept the walls farther from each other, to increase the potential area through which the NPC can walk but it still does not work the way as intended.
I am clueless about what to do to solve this. I have looked around devforum but I didn’t find any suitable solution.
Here is my code: (It includes some more code which is a buggy player follower on sight.)
Here is a video for demonstration.
(apologies for the laggy video, it wasn’t like this when I recorded.)