I want to force NPC too lose sight of Detected Enemys even player still is in the sight of NPC ? how could I do that?
Any help would be appreciated?
There is probably many ways to do that…
For example, you could insert logic in your Behavior Tree nodes to force the NPC to act as if they don’t see your Player?
We would need to understand under what conditions you need that to happen.
Or maybe you can access the radius variable that you set initially for the AI’s behavior and change it dynamically… don’t think I’ve tried that maybe you can alter it with nodes in your tree, under a task node etc.
I have dealt with this for a course before, and usually there is also a radius you define (larger than the eye-sight radius) where outside of which the NPC can “lose sight” (e.g. by losing the reference to the Player object, or wiping a last seen location etc.) but haven’t heard about forcing this to happen when elsewhere in your code and logic the Player is still technically within the AI’s line of sight (or perception or whatever).
As mentioned above, perhaps if you provide more details here in the forum we can figure out a way to help better…?
Hi, thanks for your replay and your time.
I want sight sense to lose the Enemy(or target), I want to use AiPerception for a Pawn class ( not a character ) and it seems it’s not perfect for a Pawn but im do my try.
when ai see an Enemy it’s his the event (or delegate ) FActorPerceptionUpdatedDelegate start Ticking base on MaxAge value, now if the Enemy exit of sight area this event stop Ticking, now problem start when the enemy get cover behind a wall ( wall cover entire body) it’s still seeing the Enemy and FActorPerceptionUpdatedDelegate event continue to ticking. now I success by overriding CanBeSeenFrom() tell the ai Enemy is behind the object but it doesn’t lose sight of the enemy and the event still ticking and see the Enemy no matter it’s behind the wall or not, the only way its lost sight of enemy is enemy get to pass by LoseSightRadius value.
I start looking through the UAISense_Sight and UAIPerceptionComponent code to figure out how it works but I couldn’t find out yet, The nearest thing im find is ForgetActor() but it doesn’t stop the event, another thing is I find out is the result of sight is store in SightQueryQueue.
I want to do this before the behavior tree and other stuff.
it will be very Great if you can help me.
thanks again for a replay.