Hey everyone,
I work on a project and pretty much want to setup an AI in Unreal for the first time.
Everything is mainly handled via code. For this enemy I just want to use a simple FSM.
I am also using die AIPerceptionComponent and the SightSense.
Here is the setup for the component:
Blockquote
PerceptionComponent = CreateDefaultSubobject(TEXT(“AI Perception”));
UAISenseConfig_Sight* SightConfig = CreateDefaultSubobject<UAISenseConfig_Sight>(TEXT(“Sight”));
SightConfig->SightRadius = 1000.f;
SightConfig->LoseSightRadius = 500.f;
SightConfig->PeripheralVisionAngleDegrees = 30.f;
SightConfig->AutoSuccessRangeFromLastSeenLocation = -1;
SightConfig->DetectionByAffiliation.bDetectEnemies = true;
SightConfig->DetectionByAffiliation.bDetectFriendlies = true;
SightConfig->DetectionByAffiliation.bDetectNeutrals = true;
SightConfig->SetMaxAge(3.f);
PerceptionComponent->ConfigureSense(*SightConfig);
PerceptionComponent->SetDominantSense(SightConfig->GetSenseImplementation());
PerceptionComponent->OnTargetPerceptionUpdated.AddDynamic(this, &AMyAIController::OnPlayerDetected);
PerceptionComponent->OnTargetPerceptionForgotten.AddDynamic(this, &AMyAIController::OnPlayerLost);
As soon as my Player is seen by my Enemy he is chased, but even if I move behind a wall the AI continously moves towards the player along the navmesh.
I already tried to debug with the AI Debug visualization but to no avail. Hopefully someone knowledgeable with AI in Unreal can help me.