Is it possible to change navigation for an AI character during gameplay?

I have a simple AI Character that moves from point to point and it will change its path if there are obstacles in way in order to make it to destination . This works fine problem is that when I change environment during gameplay , it will still follow same path meaning that it will not be able to reach destination . It seems that navigation is built when you before you open a level , but is there a way to change it during gameplay ?

A video of problem can be found here .

https://www…com/watch?v=mpcjJrosxHs&feature=youtu.be

Thanks

Hey DaveHall17,

Go to Edit > Project Settings > Navigation Mesh and make sure Rebuild at Runtime is enabled. When you hit Simulate, you should see your NavMesh update as your environment shifts. Let us know if that doesn’t fix issue for you!

Hey !

I’m not sure that solution you suggested above fixed DaveHall17’s issue, but I know that it didn’t fix mine. I’ve placed walls to block a path and started game. wall is then removed mid game, but AI characters cannot move through open path. I’m assuming NavMesh isn’t recalculating.

Any help would be appreciated. Thanks!

Hey tthorpe,

In addition to Rebuild at Runtime setting, go to Edit > Project Settings > Navigation System and make sure Build Navigation at Runtime is enabled. Also check your Dirty Areas Update Freq; this should be at 60 by default.

Thanks .

I attempted all of changes you suggested, but it is still failing.

Does update only work with version 4.2.0? I have seen a few tutorials online stating this, but I don’t have this version.

Hi Tthorpe,

Quick question about video; What is platform that is moving? Is it an Actor or components of an actor that has moved?

I ask because if a component is moved, but not entire actor, it will not update navmesh. Please let me know if that may be related to issue. Thank you for your patience as we investigate error.

Hey tthorpe,

Which version of editor are you using?

I am using version 4.1.1.

Okay, I’m going to try and duplicate your project in 4.1.1 and see if I can reproduce issue. If I can, I’ll then try updating project to see if an updated editor would solve problem for you. My suspicion is that it will; there have been some improvements with Nav Mesh system since 4.1. Is there a reason you haven’t updated to 4.3 yet?

If you wouldn’t mind, could you let me know a few things before I start:

  • Are your walls Blueprints with a Static Mesh component? or are they BSP brushes or Static Mesh Actors placed in level?
  • What are you using to remove walls? Level Blueprint, Blueprints themselves, or something else?

Thanks!

Thanks .

I imported a simple .fbx model that is being used as a plane to walk around on. wall pieces of geometry, that are being moved off of plane, are also simple .fbx models. They each have their own Static Mesh component.

wall pieces are being moved with Level Blueprint with a simple button press, as is AI character.

character is sent from a Target Point A to Target Point B, and is unable to reach point whether wall exists or not. wall is initially positioned in place when game starts, and NavMesh doesn’t change when wall is moved in-game.

Let me know if you have any other questions.

Okay, I can confirm that issue that appears in 4.1.1 is fixed in 4.3.1. If at all possible, I would recommend upgrading and then making a copy conversion of your project, making sure settings are same as listed above, and see if you run into same problem. There were a fair amount of improvements with Navigation and Behavior Tree systems with last few updates, and you might run into fewer problems.

Hope that helps!

I will attempt to upgrade version and see if I can get it working. Thanks for all of your help . I will let you know if I run into any problems.

, I attempted to update to 4.3.0, but I am receiving an error with using following line:

#include “EngineKismetLibraryClasses.h”

It is stating there is no such file or directory, but file worked in 4.1.1.

Any help would be appreciated. Thanks!

I believe that class is no longer used as of 4.2. Did you create this project as a code project or add code to a Blueprint project? Or did you build it from source? Either way, it is possible you added that file at some point and it shouldn’t be necessary anymore. Most likely it is referenced in [YourGame].h as an #include.

If you can find it and get rid of it, then build and save project, you should be able to convert project through Launcher to 4.3. Let me know if that doesn’t work or if you can’t find file.

, project was generated for code. I removed #include from [Game].h file, and I had some errors stating things were undefined or undeclared.

I have included an image of errors:

EngineKismetLibraryClass.h just included older Kismet Header files. I’m not sure how to fix this one. Any help would be appreciated. Thanks !

Hi tthorpe,

Is CentralReceiver.cpp a file that you had created for your project?

Hi ,

CentralReceiver.cpp is a file I created. This file used Socket objects and functions from Kismet library.

Could you that file and upload it here? I’ll take a look and see if I can determine what changes need to be made to get it working again for you.

Thanks .

I attached two images of code where it has errors. They cannot recognize any of networking code that was built from Kismet.

We were capable of sending and receiving data using this code prior to 4.2. I’m not sure what is causing it to fail.

Please let me know if you have any questions.

As near as I can tell, following lines should clear up most, if not all, of those errors:

#include "../Sockets/Public/SocketSubsystem.h"
#include "../Networking/Public/Interfaces/IPv4/IPv4Address.h"
#include "../Sockets/Public/IPAddress.h"

I am not too sure how those files related to EngineKismetLibraryClasses.h, though.