So i’ve got an AI controller with both a sight and hearing sense config all set up.
The issue is that, in doing these tasks in blueprint, you can easily set the max age of the sense along with the other variables (peripheral vision, hearing range, etc) in the component details.
For some reason, and if I’m being completely dense point that out, I can’t set the max age along with my other sense config variables in C++ along with the others as it’s protected.
Here’s the code from my AI controller constructor, everything works perfectly, except the actors sensed never expire.
SightConfig->SightRadius = 750.0f;
SightConfig->LoseSightRadius = 1000.0f;
SightConfig->PeripheralVisionAngleDegrees = 90.0f;
SightConfig->DetectionByAffiliation.bDetectEnemies = true;
SightConfig->DetectionByAffiliation.bDetectFriendlies = true;
SightConfig->DetectionByAffiliation.bDetectNeutrals = true;
HearingConfig->HearingRange = 1500.0f;
HearingConfig->LoSHearingRange = 2000.0f;
HearingConfig->DetectionByAffiliation.bDetectEnemies = true;
HearingConfig->DetectionByAffiliation.bDetectFriendlies = true;
HearingConfig->DetectionByAffiliation.bDetectNeutrals = true;
PerceptionComponent->ConfigureSense(*SightConfig);
PerceptionComponent->ConfigureSense(*HearingConfig);
PerceptionComponent->SetDominantSense(SightConfig->GetSenseImplementation());
PerceptionComponent->OnPerceptionUpdated.AddDynamic(this, &ABasicPatrollerController::OnActorSensed);