How to make ai walk more naturally?

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.

4 Likes

You can use pathfinding for this !
If you want an explaination ask me !

1 Like

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

2 Likes

Increase AgentRadius will fix this:

I’m not sure about the other things though.

2 Likes

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.

1 Like

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.