How do I calculate “Agent Parameters” for a Character?
Is it possible to use Humanoid Scale Values as references?
How do I calculate “Agent Parameters” for a Character?
Is it possible to use Humanoid Scale Values as references?
I’m sure it’s possible to use Humanoid Scale Values to calculate this, but first I think you need to understand what it’s asking for, fundamentally:
The default character’s collision model is 5 studs high, and 4 studs wide (rounded up). The Height and Radius parameters your provide should match the height and radius of your character’s collision model.
If your using normal character humanoids, you can probably set these to math.ceil(5*heightScale)
and math.ceil(2*widthScale)
, but I have not tested it.
AgentHeight
is how tall your character’s collision model is in studs. If this is wrong then your path will either try to go through doorways that are too small or not go through doorways your character fits under. This has to be an integer, so round up! math.ceil(height)
AgentRadius
is one half of the width of the character’s collision model, if its collision model was a cylinder:
Again, this has to be an integer, so round up! math.ceil(radius)
or math.ceil(diameter/2)
. If this is too small, then the character will get stuck on corners or try to fit through gaps that are too small. If this is too large, then it won’t attempt to fit through small gaps that it can fit through.
The default radius is actually big for the collision model, but it’s the closest integer radius you can get! The real diameter of the collision model is closer to 2.2
, so the radius is 1.1
. You have to round up though, which means the closest good radius you can use is 2
. math.ceil(2.2/2) == 2
aka math.ceil(1.1) == 2
AgentCanJump
is whether or not you want to allow jumping (crossing gaps or climbing small ledges) in your path.
https://gyazo.com/6418a2e9ec4f529a0a9107895a7fc027
Works very well, although there are flaws on the Pathfinding algorithm itself where the Character can fit the space but it won’t go through and such hopefully more work get’s done on the Service like mentioned in the new wiki.
Thank you for your response!