I’m working on a game (based on SCP) that contains a lot of doors, I have to work on AIs that have to be able to follow the player while opening those doors.
so I’m thinking of using the Pathfinding service but I noticed that there is no way to ignore specific parts
i tried to make a for loop with calculates the distance between the NPC and each door but it’s not really efficient (150 doors) and it doesn’t work every time.
so the question is: is there an alternative to get around this limitation?
There’s no built-in way. My best idea is to have a completely separate map that’s far away from the actual map and only has the geometry that should be considered for pathfinding. Instead of pathfinding in the “real” map, AIs pathfind in this “fake” map, which is offset from the real one by some Vector3. You add that Vector3 to get from the real map to the fake so you can do pathfinding there, and subtract it to go from fake to real to get the points along the path.
I would actually recommend writing your own path-finding system using the A* algorithm.
Here’s a great video to quickly learn the basics of it with a 2D grid (which can be 3D as well, however it will be up to you to make it as optimized as possible): A* Pathfinding (E01: algorithm explanation)
You can scale the nodes up as large as you want, or use a Navigation Mesh(which is generated using polygons to fill up a given area with as few parts as possible). Either will help optimize large distance path-finding.
basically , all doors are stored in a folder and a script disables door collisions on the server but not on the client (because of a localscript called by a remote event) , and it’s working perfectly ^^
thank you for helping anyone , and hope my solution can help you as well ^^
This is very late but there actually is! I was having the same issue and this was the first result so I’m also informing the same people with the same problem.
In the Documentation there is a whole section about ignoring parts! You need to enable the beta pathfinding feature in studio settings. All you gotta do is create a part that encompasses the door and add a Pathfinding Modifier and enable the PassThrough Property. Make sure the part is Anchored and Collision is Off.
To Enable the feature go to file > Beta Features and check the box with the one you want to enable (you will have to restart studio for this to take an effect).