Hi there,
I ran into an issue with AI using the Seek task to pursue the player, where the AI agent will just freeze in its tracks if the player stands in certain spots. This appears to be due to some frustrating limitations in the Movement Pack's integration with Unity's NavMeshAgent for path finding. I don't think the nav mesh can be expected to perfectly represent everywhere the player can get to. For one thing, the NavMeshAgent pathing seems to have a tendency to leave characters stuck on corners, so it seems to be necessary to bake a nav mesh with some buffer, in which case just cozying up to a wall can move the player ever so slightly off the nav mesh. But even without that, there end up being places, like on top of crates or on top of railings, that the player can get to that the nav mesh won't extend to.
Now, I have some programming background, but I'm very new to game dev, AI, etc., so if I'm missing something obvious, please let me know. But it took about 2 minutes on Google to find that positions passed to Unity's NavMeshAgent first need to be verified to ensure they're on the nav mesh (they provide a method for that), and if it's an invalid position, there's another method to get the closest valid position on the NavMesh. I would think accounting for that would be a basic implementation requirement for any nav-mesh-based movement AI, but again, I'm new to this. Maybe I'm expected to handle that myself through the Behavior Tree before passing the position to Seek. Fine, I can do that. There's a bunch of NavMeshAgent tasks, surely they expose those crucial methods... Nope.
Okay, I can work around that too. Behavior Designer has reflection. I can call any method on anything. I'll just use the Get Component task to grab this character's NavMeshAgent... Except I need to reference a GameObject to do that, and unless I'm missing something – I must be!? – there's no way to fetch the GameObject attached to the Behavior Agent. (I realize you could manually assign it to a variable, but that won't work when spawning the character from a prefab.)
I've tried several workarounds, and at this point, I'm out of ideas. It seems like either I'm missing something obvious, I'm using NavMeshes wrong, or the Movement Pack left out a key piece of integrating with Unity's nav mesh system and I'm going to have to rewrite its movement tasks for use in production. Given the popularity of this asset, I'm assuming/hoping it's one of the first two.
What's my best path forward here?
I ran into an issue with AI using the Seek task to pursue the player, where the AI agent will just freeze in its tracks if the player stands in certain spots. This appears to be due to some frustrating limitations in the Movement Pack's integration with Unity's NavMeshAgent for path finding. I don't think the nav mesh can be expected to perfectly represent everywhere the player can get to. For one thing, the NavMeshAgent pathing seems to have a tendency to leave characters stuck on corners, so it seems to be necessary to bake a nav mesh with some buffer, in which case just cozying up to a wall can move the player ever so slightly off the nav mesh. But even without that, there end up being places, like on top of crates or on top of railings, that the player can get to that the nav mesh won't extend to.
Now, I have some programming background, but I'm very new to game dev, AI, etc., so if I'm missing something obvious, please let me know. But it took about 2 minutes on Google to find that positions passed to Unity's NavMeshAgent first need to be verified to ensure they're on the nav mesh (they provide a method for that), and if it's an invalid position, there's another method to get the closest valid position on the NavMesh. I would think accounting for that would be a basic implementation requirement for any nav-mesh-based movement AI, but again, I'm new to this. Maybe I'm expected to handle that myself through the Behavior Tree before passing the position to Seek. Fine, I can do that. There's a bunch of NavMeshAgent tasks, surely they expose those crucial methods... Nope.
Okay, I can work around that too. Behavior Designer has reflection. I can call any method on anything. I'll just use the Get Component task to grab this character's NavMeshAgent... Except I need to reference a GameObject to do that, and unless I'm missing something – I must be!? – there's no way to fetch the GameObject attached to the Behavior Agent. (I realize you could manually assign it to a variable, but that won't work when spawning the character from a prefab.)
I've tried several workarounds, and at this point, I'm out of ideas. It seems like either I'm missing something obvious, I'm using NavMeshes wrong, or the Movement Pack left out a key piece of integrating with Unity's nav mesh system and I'm going to have to rewrite its movement tasks for use in production. Given the popularity of this asset, I'm assuming/hoping it's one of the first two.
What's my best path forward here?