What would the best or a somewhat more simple way be to make npc characters walk more naturally and not take the shortest path jumping over weird objects and going againts walls.
You can use pathfinding for this !
If you want an explaination ask me !
His problem is not pathfinding⦠He said he wanted it to be more realistic as the npc is jumping over weird objects and going through walls
Increase AgentRadius
will fix this:
Iām not sure about the other things though.
Sure, agent radius may help a little bit with this , but I would like it to go in a more clean path.
The problem with agent radius is that if it for example have to go through a door and its not as big of a gap. the agent radius sometimes has weird paths where the npc goes away from the goal and then comes back.
I heard you could make your own waypoints , but is that a little bit complicated for everything or does this have something to do with making the path a region it desires.
here is an example of what I would like.
I
also ā¦ten points and a parrot badge for whoever can solve why my npc when it goes for a nother path it looks exactly like if you were to spam press āwā instead of holding to walk.
Then, you can do PathfindingModifiers
to add priorities to the path it should take. Or, you can add costs to materials.
I tried adding low cost to a modifier that goes thru the center of that room , but it just wasnāt taking the route , instead it was only going the short way
Dont all of these seem like problems with your script? your humanoid shouldnt move as it was pressing w repeatedly.
could be a lot of things, the path node spacing is too close together and or the AIās ownership is not set to the server. iāve had my fair share of annoying path finding bugs that iāve just had to figure out on my own, the documentation is kind of horrid to the issues you can face .-.
I donāt quite understand what you mean by that, the humanoid isnāt pressing anything.
If you are referring to my previous response
I know there has been problems with network ownership and I have been told to set it nil and that did fix my problems so I guess thats that, but anyways there should not be any problem with the script itself , just some part of my understanding
local path = PathfindingService:CreatePath{
AgentRadius = 1,
AgentCanJump = false,
Costs = {
Center = 0.1,
}
}
I agree, sometimes for me its not just bugs just a simple mistake or forgetting to do something.
Itās been a bit since I worked with pathfinding , does the cost automatically make it follow that modifier path or did I have to add if waypoints[nextWaypointIndex].Label:match("Center")
to then make it follow the path, since the documentation doesnāt say anything like that with the modifiers , only links and I am not sure do the modifiers and links work the same for the ācostā
local path = PathfindingService:CreatePath{
AgentRadius = 1,
AgentCanJump = false,
Costs = {
Teleport = 0.1,
Center = 0.1,
}
}
it aināt even bugs for me, i couldnāt get the AI to walk in a normal way instead of hugging walls, my hacky way of fixing it was literally making giant walls around my map and made it so that it had a cost value of math.huge so the AI wouldnāt walk into it, and if a player was in it, itād just path to the closest point to the plr and then just :MoveTo()
the rootpart/torso position. not a lot of ways to fix pathfinding, its something with the math i assume or iām doing something wrong and i canāt find an actual fix for it online. following the documentation 1:1 doesnāt give you the desired output which is an issue i think.