I have some NPCs wandering around with moveto a random location. It works great, the npcs move around randomly, pathing correctly.
I place some “elevators” (at run time) that are functionally just smart links. I Bind Event to On Smart Link Reached and that event gets the npcs location and destination, sends it to the NPC bp, and runs an elevator move event to manually move them:
They do occasionally hit the smart links and a print text verifies that they do. I am having two problems with this though:
First, the second an elevator is placed, the NPCs go from correct, smooth movement from random place to place to moving erratically, seemingly ignoring the navmesh and going wherever they want (walking into walls, getting stuck on objects, standing still, jittering in place, etc…)
Second, when they do occasionally make it to the elevator, they seem to get “stuck” for a while and dont continue on to where they were pathing when they first hit the smart link. When/if they continue moving again, they go right back along the smart link they took.
I you haven’t already, first I would suggest deleting the simple links in the link proxy actor. I’ve had problems before with npcs jittering under a platform the smart link is trying to tell them to jump up to. Seemed to be the smart link and dumb link fighting or something. Second, instead of smart link calling a timeline to move the actual actor, might be better to set a blackboard key that has them wait in the elevator. and have it physically carry the actor. Would probably need a dispatcher in elevator bp to inform listening passengers they’ve arrived at floor tho (or maybe just oneway smartlinks for exiting elevator?). Might also want an invisible floor inside the elevator shaft at each stop with a custom collision channel which chars are set to ignore while riding. Just to ensure nav recast finds the path. Even if using dynamic navmesh, it can be slow to update moving platforms.
I have tried deleting the simple links, and tried adding them back with the same locations as the smart links. Neither had an effect.
I wasnt sure what a blackboard key is, so I did a quick search. That seems to apply to behavior trees, which I am not using (yet). I think it may be time to set that up in case this is the solution. There is no platform in the elevator (its just a tube they float in, think star trek tractor beams) but I guess I could make an invisible one. I’m not sure if I can make that work or not because of the following:
An additional complication is that the elevator isnt one piece. Its actually made of modules (top, shaft, tee, bottom) and assembled in game, like subnautica structures. Each piece has its own nav link proxy and an invisible floor that the smart links connect to, so they have a navmesh to connect to.
The newer state tree system might be better than behavior tree for this. Either way,having a branch or state for riding may help teh ai not to freak out. As for modularity, you could use trigger volumes under invisible floors to turn off a collision response on begin overlap, like in the sidescroller variant of the 3rd person project template.
Might also be worth testing a direct teleport instead of vinterping to see if it’s the wait causing AI to panic lol. If teleport works may just need a behavior or state tree to pause ai decision making.
I havn’t gotten to check out any tree systems yet, but I fixed some of the issues. I adjusted the manual move to put the NPCs just above the destination point (by half the NPC height) instead of right at it. I also found a setting in the NPC character movement called stop movement abort paths. It was on. Once I turned it off, they mostly continue their path after getting moved in the elevator. Turning off can walk off ledges and turning on requested move acceleration seemed to help with most of the erratic behavior when not pathing through the elevator.
Now I’m left with this: Occasionally the NPCs will go out of bounds of the nav mesh as shown in this video.
I am also still having issues with the NPCs getting “stuck” in the elevators, as well as a new issue where they now sometimes go up the elevator half way, then go right back down then through the floor as shown in this video.
Hopefully someone has seen similar behavior and knows how to fix it. I’d really like to get these issues resolved before I try to add any kind of behavior tree, so I don’t end up compounding the problems.
EDIT: I did a test with a direct moveto to an actor set on the top floor of the square module. The NPCs path correctly to it at first, until they hit the bottom floor of the elevator, then they stop and don’t proceed further. Clearly the stop movement abort paths wasn’t the only thing interrupting the pathing. They do consistently keep their path through the midpoint between the elevators and only stop pathing correctly when they hit the destination point of the bottom smart link.