- a path that the AI has calculated may become blocked by unwalkable tags (ie for a door).
- if that happens, then the AI keeps trying to recalculate a path.
- the info message says to use “calculatePartial” to prevent this.
If I set a destination directly on AIPath with
this.destination = destination;
How can I set calculatePartial for all pathes in this case?
Hi
There’s no exposed option for calculatepartial on the AIPath script at the moment. Using calculatePartial requires either that:
- You use
ai.SetPath
instead.
- or that you sub-class the AIPath script and override the
SearchPath
method to add calculatePartial = true
.
1 Like
Regarding Option 2 (which would be the best for me):
I have sub-classed AIPath, but I can not access calculatePartial in SearchPath() of the child class either.
How would I go about doing that?
Edit: I tried using setWalkability instead of tags, since an old forum post indicated that would
make calculatePartial unnecessary.
But the agent just walks over the area where I modified the walkability.
What could possibly be wrong with this:
GraphUpdateObject guo = new GraphUpdateObject(_doorWalkabilityCollider.bounds);
guo.modifyWalkability = true;
guo.setWalkability = true;
AstarPath.active.UpdateGraphs(guo);
I needed to also add:
guo.updatePhysics = false;
Without this line, walkability will not update.
1 Like
You will need to duplicate the implementation of the original AIPath.SearchPath function, and then set the calculatePartial field on the created path object.
But yeah, I really should be exposing this field so that this is easier to do.
1 Like