Perception: Stimulus WasSuccessfullySensed

I’m having trouble with getting events for stimulus, I did all the set up from the quick start but am not receiving events due to AIPerceptionComponent line 405
if (SourcedStimulus->Stimulus.WasSuccessfullySensed() == false)

Searching the code base I can’t find anywhere where WasSuccessfullySensed will be set to true, it returns UPROPERTY(BlueprintReadWrite, Category = “AI|Perception”)
uint32 bSuccessfullySensed:1; // currently used only for marking failed sight test

Which is always false. Where am I suppose to set this to true? I am not using blueprints.

Thank you
Brian

I found the source of the issue, my PeripheralVisionAngleDegrees was 360, which was treated as zero

In creating the Digested Sight Properties
UAISense_Sight::FDigestedSightProperties::FDigestedSightProperties(const UAISenseConfig_Sight& SenseConfig)

PeripheralVisionAngleCos = FMath::Cos(FMath::DegreesToRadians(SenseConfig.PeripheralVisionAngleDegrees));

Equal 1, Which is equivalent to 0 degrees

Then in AISense_Sight::Update() (AISense_Sight.cpp:Line205)

else if (CheckIsTargetInSightPie(Listener, PropDigest, TargetLocation, SightRadiusSq)
is always false.

… CheckIsTargetInSightPie(…)

return FVector::DotProduct(DirectionToTarget, Listener.CachedDirection) > DigestedProps.PeripheralVisionAngleCos;

**Always false when PeripheralVisionAngleCos==1 **

Using 180 degrees worked

Found the problem. Successfully Sensed is getting set to true on detecting the player but then getting set to false because of the setting ‘Auto Success Range Last from Last Seen Location’ . It was set to -1 by default, so the AI detects the player and then fails to detect the player cuz the success range is invalid. If i set this to 0 or greater and then remain at the spot or stay within the defined range of where i was detected by the AI. The successfully sensed remains set to true but if i get out of that range, it gets set back to false and then immediately to true.
I have no idea why they added this feature! Its a game-breaker!

1 Like