Enemy Layers and Attack BD+Deathmatch AI Kit

Vlaxep

Active member
Hi,

I've been having issues with setting the Enemy layers on an AI agent.

In attempt to avoid changing the layer of existing Character collider I attempted using a second collider within 'Colliders' object inside my character, and set it to layer 'TeamLayer Players'. This causes a bunch of issues I won't list, even despite trying to play around with Physics collision layer matrix.

So I seem to be able to solve it by simply setting the Layer of the 'CapsuleCollider' of my player character to 'TeamLayer Players' after running the game.

Problem is if I set it to this layer before running the game my Character falls through the floor.....(doing it after works fine)

Reason for not wanting to use 'Character' layer as Enemy in my AI Agent's Layer manager is that all characters by default seem to have their Capsule Collider set
to 'Character' so I don't want my AI shooting each other or any character that isn't their enemy....

If there's a better way i should be doing this I'd be happy to hear suggestions.

- My game is not deathmatch, just utilising the AI behaviours for 'teams of AI', though I will be using formations, tactics, backup, cover
- PvE only, though I need to be able to have friendly AI also, and multiple teams
 
Also I notice that placing a simple Cube in to the scene with the correct enemy layer doesn't make the Agent attack the cube.

So it might be helpful if anyone could outline what process actually takes place to make AI Agent attack a target?

I'm guessing it checks whether it's actually a Character in some way as I know it looks for the body part to aim for 'ie default is 'head'

Mainly I just want to know the best practice to set up for each character's layers for 'team' scenario.

Cheers
 
If you are changing the layers you should change what layers are a solid object, invisible object, enemy, etc. This can be done on the Character Layer Manager component. For collision checks you should also verify the Collider Layer Mask is correct on the Ultimate Character Locomotion component.

This video shows how to setup a character to attack a target:

 
Top