Disable DetourCrowds

Hey, I am using DetourCrowds to tell my character to avoid another characters.
In the AAICONTROLLER I have this code which enable DetourCrowds:

AVikingController::AVikingController(const FObjectInitializer& ObjectInitializer) :
Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent")))
{
}

I have wondered is there a way to disable it?

Use UCrowdFollowingComponent::SetCrowdObstacleAvoidance(false).

Cheers,

–mieszko

Thank you for the answer, how can I get a reference to the UCrowdFollowingComponent object?

Your AI Controller will have a reference to the crowd following component. Check the PCIP in the constructor. I believe it’s usually listed as the “PathFollowingComponent”

I strongly suggest you read source code you’re trying to use :slight_smile:

You need to do this:

UCrowdFollowingComponent* CrowdComp = Cast<UCrowdFollowingComponent>(PathFollowingComponent);

while inside AI controller code.

Thank you! it works! :smiley: