diff --git a/Content/Enemy/BP_AIController.uasset b/Content/Enemy/BP_AIController.uasset index 8b4a0b6..237e9cd 100644 --- a/Content/Enemy/BP_AIController.uasset +++ b/Content/Enemy/BP_AIController.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7240119efa81695648e4d7e39a0a66382ef69ad97845c6c55754b118b229142e -size 14422 +oid sha256:c6a9d208634f0674742d2893a4f054d8a98ee134b2b41bfd35480a7f39ac1d68 +size 14565 diff --git a/Source/vampires/VampireAIController.cpp b/Source/vampires/VampireAIController.cpp index bea12b7..516ae74 100644 --- a/Source/vampires/VampireAIController.cpp +++ b/Source/vampires/VampireAIController.cpp @@ -4,11 +4,11 @@ #include "VampireAIController.h" #include "BehaviorTree/BlackboardComponent.h" -#include "Components/CapsuleComponent.h" -#include "GameFramework/PawnMovementComponent.h" #include "Kismet/GameplayStatics.h" +#include "Navigation/CrowdFollowingComponent.h" -AVampireAIController::AVampireAIController(const FObjectInitializer& object_initializer) +AVampireAIController::AVampireAIController(const FObjectInitializer& object_initializer) : Super( + object_initializer.SetDefaultSubobjectClass(TEXT("Path Following Component"))) { Blackboard = CreateDefaultSubobject(TEXT("Blackboard")); BehaviorTree = CreateDefaultSubobject(TEXT("Behavior Tree")); @@ -18,6 +18,13 @@ void AVampireAIController::BeginPlay() { Super::BeginPlay(); GetWorldTimerManager().SetTimer(PawnMoveToTimerHandle, this, &AVampireAIController::PawnMoveTo, 0.25f, true); + + if (UCrowdFollowingComponent* CrowdFollowingComponent = FindComponentByClass()) + { + CrowdFollowingComponent->SetCrowdSeparation(true); + CrowdFollowingComponent->SetCrowdAvoidanceQuality(ECrowdAvoidanceQuality::Good); + CrowdFollowingComponent->SetCrowdSeparationWeight(10.0f); + } } void AVampireAIController::Tick(float DeltaTime) diff --git a/Source/vampires/VampireAIController.h b/Source/vampires/VampireAIController.h index 3bd709a..c743376 100644 --- a/Source/vampires/VampireAIController.h +++ b/Source/vampires/VampireAIController.h @@ -4,6 +4,7 @@ #include "CoreMinimal.h" #include "AIController.h" +#include "DetourCrowdAIController.h" #include "EnemyCharacter.h" #include "HealthComponent.h" #include "PlayerCharacter.h"