Pathfinding agents

Recently I’ve been quite into pathfinding.

I noticed the on the computeAsync documentation, the example shows more than 3 agent params. Here’s the link: Path | Documentation - Roblox Creator Hub

On the actual tutorial, I was told that there are only 3 params for agents.

So can someone either explain if that’s an error or explain to me what that does and what other params there are?

Edit: I can no longer find the extra parameters. I think they removed it or something. Maybe they’ll update pathfinding in the future?

What do you mean? ComputeAsync is an aspect of pathfinding and has its own two parameters.

Look at the link and check out the examples.

By agent params, I mean the table with the parameters, where it has “water” and “minefield” and these kind of stuff.

I don’t think those other parameters are required, are they?

No but I want to know how they work and see if they could make my life easier. So do you know what they do?

Sorry I don’t know what all the parameters are.

AgentWalkableClimb is probably something got to do with the humanoids climb?
AgentCollisionGroupName is probably CollisionGroups that can be used to whitelist certain instances/ objects to ignore.

The rest I honestly have no idea.

These “AgentParams” aren’t for the :ComputeAsync() function, they’re being used for the :CreatePath() function:

local path = PathfindingService:CreatePath(agentParams)

As for these extra parameters, I’m unsure what they do. I have not used them before.

I suppose the documentary for pathfinding is still rather incomplete

The other parameters are extra, they can define things like the size of the character and how high they can jump and if they are allowed to jump.

For example a giant might be much bigger so would use this.
It can also have other applications like testing for tiny holes in maps.

Ok.
Look at the link.
I know what the 3 agent params are.
The link has like 10 other parameters that was never mentioned anywhere else.

1 Like

Yes, you have your base pathfinding: StartPoint, EndPoint, CanJump

Then you have the extras:
Char Radius
Char Height
Collision Group
Material Weights
Walkable Climb (Climb Speed / Can Climb).

Its rather simple, think about what you might actually need. Like radius and height will be one of the more commonly used extras. Same goes for collision group. Just think about what it is you need to make a path for. e.g if there is a invisible wall that only the bot can walk through then collision group will come into play.

The documentation is correct but you will need to better understand each of the definable pathfinding elements. This will come when you have a use for them.
The best bet is to understand each of these elements along with arrays and waypoint actions. That breaks things down to make them more understandable.

Here are the elements defined in the API:

local agentParams = {
	AgentRadius = 2.0 --(The Radius Of The Object(Half Its width))
	AgentHeight = 5.0 --(The Height Of The Object)
	AgentWalkableClimb = 2.0 --(Whether or not it can climb)
	AgentCollisionGroupName = "RedPlayers" --(Collision group)
	CollectionWeights = { Bridge = 2.5, Minefield = math.huge } --(Going to research)
	MaterialWeights = { Water = 1.5 } --(Weight In Materials)
	AgentCanJump = false --(Whether or not it allows jumps)
}
 
local path = PathfindingService:CreatePath(agentParams)

They are mostly self explanatory the only one I am going to go away and research is Collection Weights.

As for waypoints they are straight forward. I would recommend making a module script that can calculate paths. Or a script with a bunch of functions you can paste.

Here is my current pathfinding script I use: (Please make sure you fully understand any code you use)

3 Likes

Very useful info!

Most of them are pretty self explanatory. I think when I asked this question collection weights was what I was looking at in the first place. Do you know what the term “collection” might mean?

1 Like