Yo guys.I am using sensing ocmponent to let the enemy have the ability of spotting player.But i only found the delegate functions OnSeePawn and OnHearNoise.I can make a bool var turns true by using OnSeePawn,but i have no idea which function can make the car turns false. i tried HasLineOfSightTo() and CouldSeePawn() in c++,but somehow those turn my bool var to true as long as i was in the spot cone(even i have items block the sight).
Is there any good solutions?
Hey @HEROSAMA1
Use AI Perception component, and the delegate On Target Perception Updated.
The Stimulus struct gives the information you need. When Successfully Sensed is true, the target is being seen, when it’s false, you stopped seeing it.
You can combine both components if you want, although it’s a little bit tricky. You can also call RequestStimuliListenerUpdate to force a check on sensing, which would trigger OnTargetPerceptionUpdated if you need it at some point.
omg thx dude!!
yeah also i found another solution in the sensing component c++ source code,there is a fuction called void UPawnSensingComponent::SensePawn(APawn& Pawn)
There you can find two “if” logic to manipulate the return boolean.All i did is copy the logic into my code and make a "blueprintpure"decorated fuction.
It works werid for the first couple seconds but after a short time it works perfectly.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.