Hi, I am trying to use AIPerception’s Team Sense (additional to Sight and Hearing).
Now I have the problem that I can’t seem to get it working. I already did the following:
- Added the sense to the AIPerceptionComponent in the AIController; Max Age is 0.0f
- Added a Stimuli Source Component to the AIController (doesn’t work on pawn also), call RegisterSource… and RegisterSense(UAISense_Team::StaticClass()) (or sth like that) AND in Blueprint override set Auto Register and added Team sense
- Call UAIPerceptionSystem::OnEvent with custom settings
- Listener and Broadcaster are both AIControllers with the same GenericTeamId, so sense should be triggered
But unfortunately I never receive Team Stimulus in OnTargetPerceptionUpdated
Here is some code:
void AZombieAIController::BroadcastTarget(AActor* Target)
{
FAITeamStimulusEvent TeamEvent = FAITeamStimulusEvent(this, Target, Target->GetActorLocation(), 100000.0f);
UAIPerceptionSystem::OnEvent(GetWorld(), TeamEvent);
}
...
if (Stimulus.Type == UAISense::GetSenseID(UAISense_Team::StaticClass()))
{
// Never triggered
SetTargetLocation(Stimulus.StimulusLocation);
}