Use what function for agent navigation when using crowd manager (detour avoidance) and dynamic navigation mesh

I have a character class and an aicontroller whose PathFollowingComponent is UCrowdFollowingComponent:

class CROWD_API AAgent : public ACharacter, public ICrowdAgentInterface
class CROWD_API AAgentAiController : public AAIController

I used to have a static navigationMesh and called

NavSys->SimpleMoveToLocation(GetController(), mainExit);

in my Agent.cpp class. When I changed navigationMesh to dynamic however, this stopped working.
I have also noticed the following function in my AgentAiController and am now unsure what function to use for agent movement and where to use it:

UCrowdFollowingComponent * crowdComp = (UCrowdFollowingComponent*)GetPathFollowingComponent();

crowdComp->RequestMove( long list of parameters... );

Any advice for navigation of agents using detour avoidance is appreciated!

…anyone?

i’m investigating this right now. I’ll let you know once I’ve got an answer

thx a million, I hope you find something!

I believe the standard approach is to use the methods on AAIController: MoveToLocation or MoveToActor. You shouldn’t need to make any calls directly on the navigation system or path following component to achieve basic navigation.

However this may not actually be the issue. It’s possible the movement isn’t happening because your nav mesh is not being generated properly. I haven’t experimented much with the new dynamic nav mesh yet, but I think it can be a bit fiddly to set up correctly. If you’re using the dynamic tile generation you need to ensure you have nav mesh invokers set up. First thing to do would be to enable the navigation mesh visualization to check that the mesh is working (enter the command ‘show navigation’ in the console while running).

Hi, so I replaced NavSys->SimpleMoveToLocation with AAIController::MoveToLocation like so:

AController* const controller = GetController();
	AAgentAiController* aiController = Cast<AAgentAiController>(controller);
	aiController->MoveToLocation(FVector(-1650, 4210, 108), 100, true, true, true, false, 0, true);

The case is the same though: static or dynamic modifiers only navigation mesh: it works.
dynamic: doesn’t work.

It occured to me that I might be calling it at the wrong place.
I moved the code from the constructor of the controller to the BeginPlay() function af the character. Same result. But if I move the code to the Tick function of the character: all cases work, also with dynamic navigation mesh.

The problem though: I got a feeling it doesn’t belong in the Tick function.

It is a latent function - when you call this function, it will make a request and then path following will be processed every tick until the character reaches the location. So yes, it should not be called every tick. You call it once each time you want your character to start moving to a new place. The most common place to call it is from within a behavior tree.

Great ok I’ll do that. Thank you