Hello, so i have a UAIPerceptionComponent that detects "hostile" actors using the team perception and attacks them. When an character is killed, i want all remaining actors to ignore him. How can i acomplish that? I tryed changing the "dead" actor's team to be "neutral" but it doesen't seem to have any effect at all. Maybe i have to force an update for the Perception? Can i do that? Is there any other better way to do this?
Announcement
Collapse
No announcement yet.
Make AIPerception ignore a certain actor
Collapse
X
-
Originally posted by redbox View PostOr you can add variable bIsDying to your characters, and other character will check it before perform attacks.
Comment
-
Originally posted by redbox View PostBut you will have some dying/death state in character anyway.
And you should check it before attack. The same as you should check some other states, like "stun", for example.
Code:TArray<AActor*> FoundActors; UGameplayStatics::GetAllActorsOfClass(this, APirateController::StaticClass(), FoundActors); for (AActor* CurrentActor : FoundActors) { Cast<APirateController>(CurrentActor)->AIPerception->ForgetActor(this); }
Comment
Comment