I created a AI with behaviour tree…the problem is it is good for a single AI but if there are More than one, if they see each other they start chasing player, even if player is not in sight
Hi, sounds like you explicitly tell your AI to go to the player (you would need to change that), can you show your behavior tree and perception logic?
The problem is that you don’t move to the actor that your AI is seeing, but always to the player. And that you move to the player if the AI is seeing anything, whether that is the player, or not. What you could do:
If you have something like AI against player (so you don’t need your AI to be able to chase other AIs), then in your second image (in OnTargetPerceptionUpdated), check that Actor == GetPlayerPawn, only then continue. That will make it ignore other AIs.
If you want it to be able to also chase other AIs, then you could add a new blackboard variable of type Actor (e.g. name something like it Target). Then inside your behavior tree you could replace all the player specific things with this new blackboard variable. And ofc then you would need some kind of switching logic between targets and some kind of team system.
Thanks alot…its working now