Missing DetourCrowdAIController in C++

I am trying to create an AI Controller in C++ but I want to inherit from DetourCrowd instead of the standard AIController.

When I look for DetourCrowdAIController out of all classes in the Unreal Editor only AIController shows up. This one is not an option. (“AIModule” has already been added as a dependency.)

  • Any idea why this could be?

As such, I created a class deriving from standard AIController and tried to reparent it from “AAIController” to “ADetourCrowdAIController” but this throws compiler errors.

2 Likes

did you find solution for this? I am having same problem.

Hi, in C++ you set it to use the UCrowdFollowingComponent instead of only the PathFollowingComponent. So in the constructor of your AI controller you do this

ABaseAIControllerCPP::ABaseAIControllerCPP(const FObjectInitializer& ObjectInitializer)

	: Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent"))) {

}

and ofc replace ABaseAIControllerCPP with your own.

6 Likes

EDIT: Solved, see my post below this one.

The function signature for the constructor is implemented as:

#include "GruxAIController.h"
#include "GruxAICharacter.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "BehaviorTree/BehaviorTreeComponent.h"
#include "GoalTarget.h"
#include "Kismet/GameplayStatics.h"
#include "Navigation/CrowdFollowingComponent.h"

AGruxAIController::AGruxAIController(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent")))
1 Like

Ah, just having the AI Controller use the UCrowdFollowingComponent, instead of the default Path Following Component, seems to work. So your answer solves the problem (without having to reparent one’s custom AI Controller class)*, I thank you :slight_smile:.

while there does seem to be a class by that name, there’s no particularly good reason why it wouldn’t show up in editor that I can see, unless you just totally don’t have the AIModule.

All it is is a regular AIController with the CrowdFollowingComponent as default instead of PathFollowingComponent though, as above.

1 Like