Nav Links - simple way to detect if an AI is using one

Well, I can think of a few reasons:

  1. This works with simple links and smart links, whereas the Smart Link Reached event only works with smart ones (and doesn’t seem to work all that well IMHO - it appears to misfire or fire off the wrong links in UE5).

  2. The Smart Link Reached event tells you nothing about when an agent has finished using a link, only that it’s been reached (and thus started). If, for example, you wanted a ghost AI to walk through a wall, you’d probably want to turn off its collisions when it started using the NavLink, then on again when it had finished. Because my above method returns a boolean value, you could use that to switch collision on/off. Smart Link Reached isn’t a boolean - it’s a fire and forget. If it was supported by a corresponding ‘On Smart Link Finished’ event, then I agree, my method would be somewhat pointless. But it doesn’t have one.

  3. You can use this boolean value to set slots on a NavLink so that only one agent can use it at a time. A ladder, for example, can look crappy if two or more agents are trying to scramble up it, even worse if one agent is going up as another is going down. When an agent begins using a vacant ladder, you can set the AreaFilter to null to prevent any other agents from using the link, then back to normal when the agent using the link has finished (a bit like slots in Smart Objects).

1 Like