Time until Location - Navmesh

Hey guys,

So I’m playing around with AI after watching the Making Game Ready AI stream and something I’m trying to do is make it so that the AI will return home (currently a cube that restores stamina) to rest before it gets dark.

My problem is that I can send them home at a certain time, but I can’t seem to figure out how to check to see how long it should take them to get “home”.

Basically what I’m asking is how I can do a check to see how long it should take for an AI to travel from point A to B. That way with my day/night cycle I can just broadcast an alert to all AI when night time is approaching and they can check to see if they need to return immediately to get home before dark or whether they can continue to do whatever task they currently have.

Makes no sense for an AI tinkering in the veggie garden outside the kitchen to start returning home at the same time as the AI out in the woods chopping trees down.

In short I just need to know if anyone can point me in the right direction for getting the time it should take to travel using the navmesh with a character actor.

I’m don’t think this is the best answer, but one way would be to find the length of a navigation path, presumably back from where they are to their home, and divide that by their movement speed, that should get a rough estimate of the time it should take. Not sure how costly that is, so you probably only want to update that occasionally. That won’t be hugely precise, but assume each AI moves roughly the same, you could just offset it manually and get something relatively accurate.