I am running into a problem with one of my pathfinding npcs, I want him to ignore doors when pathfinding so he isn’t stuck in one room until you find him, but every post I see about this says to just make your own pathfinding. I heard A* is the most efficient, and I have found a few examples, but how would I translate this to an npc? The ones I have found are very simple showcases of it and I wish I could find an example of an npc utilizing it. Can someone give me some resources(videos, wikis, books, etc) to point me in the right direction, as I feel like this is a bit out of scope for me to figure out for myself. I am not asking for you to write an advanced A* pathfinding npc for me, simply just to point me in the right direction.
The key for an NPC, is to translate it into 3D, the simplest way to do it is with a grid representing Vector 3 coordinates. And a custom built Get Neighboring cells function.
Learning the grid is an entire topic by itself one way to learn how to translate a 2d table grid into 3d coordinates is from terrain generation, there is an integer cell and it translates into vector 3.
gridData[1][1] = Vector3.new(0,0,0)
gridData[5][5] = Vector3.new(5,0,5)
From there you can traverse this 2d Grid using A star path finding from gridData[1][1] to gridData[5][5] and move an npc from vector3.new(0,0,0) to Vector3.new(5,0,5) using :MoveTo or tweening depends on what you want.
here are some more resources,
Thank you everyone for your responses, this is very helpful!
Yeah you can get the code from Wikipedia, nd also decide a way to define walkable and non-walkable nodes, plus Doors…
You could use a ray-caster, and include Doors in the Whitelist (The model itself:
You could turn that place into a 3D chessboard., and have Players drop bradcrumbs with info of Next Breadcrumb… This method would ignore Doors…
You could use Roblox Pathfinding but fix the Doors: Make them out of water… or somehow make them walkable to the Pathfind…
You could use the new pathfinding modifiers for this, although it’s still in beta.
l was not aware of this, I will get on this right away! Thanks! I actually just made my npc find the nearest door when the patrol paths fail so it can’t get stuck, but this will be so much better!