x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AI perception: Pawn never loses sight

Hey everyone,

I think I found a bug with the AI Perception system. I have an AI Pawn set up to use sight. When leaving the outer lose sight radius, my perception isn't updated to inform my AI Controller that the sight has been lost:

 void AEnemyAIController::OnTargetPerceptionUpdated(AActor* Actor, FAIStimulus Stimulus)
 {
     GEngine->AddOnScreenDebugMessage(-1, 2, FColor::White, FString::Printf(TEXT("Target %s perception updated!"), *Actor->GetName()));
     if(Stimulus.WasSuccessfullySensed())
     {
         GEngine->AddOnScreenDebugMessage(-1, 2, FColor::Cyan, FString::Printf(TEXT("Target %s sensed!"), *Actor->GetName()));    
         SetEnemy(Cast<ASpaceShip>(Actor));
     }
     else
     {
         GEngine->AddOnScreenDebugMessage(-1, 2, FColor::Cyan, TEXT("Target lost..."));    
         SetEnemy(nullptr);
     }
 }

I'm only receiving one call to the update method when the player is sensed. This was working in the past. Not sure when but I guess around UE 4.17. I'm registering the method in begin play:

 void AEnemyAIController::BeginPlay()
 {
     Super::BeginPlay();
 
     UAIPerceptionComponent* perceptionComponent = GetPerceptionComponent();
     if (ensureMsgf(perceptionComponent, TEXT("Perception component not set, cannot intialize target perception updating")))
     {
         perceptionComponent->OnTargetPerceptionUpdated.AddDynamic(this, &AEnemyAIController::OnTargetPerceptionUpdated);
     }
 }

I also recorded a video showing how the AI never loses sight of me: https://youtu.be/Fm7vhcq7GKk Is this a bug or did something change and I'm doing it wrong now?

Product Version: UE 4.19
Tags:
more ▼

asked Apr 02 '18 at 08:36 AM in Bug Reports

avatar image

zaha
67 7 9 16

avatar image Jeff A ♦♦ STAFF Apr 02 '18 at 04:23 PM

Hello,

We've recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://forums.unrealengine.com/unreal-engine/announcements-and-releases/1410408-unreal-engine-bug-submission-form

Thanks

avatar image zaha Apr 04 '18 at 05:38 AM

Hi Jeff A, thanks for the hint. I'll take a look at it and will try to reproduce the bug in a new project when I find the time to do so.

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question