Well it seems I’ve hit a brick wall with figuring out how to create footstep audio for my enemy AI. No matter where I go I can’t seem to find a tutorial or any solutions.
I tried to recreate what I did for my playable character, which did produce foot step sounds for me, but at my characters location and not where the AI was wandering.
Which if I had to guess the reason that happened would be because of these two nodes. I just can’t seem to wrap my head around what else I would place in their spots to take ‘Footstep Sound’ and attach it to ‘Enemy AI’.
Hi, you are right with your guess and it definitely makes sense that footsteps are being player from player location, as you pass there player location (nodes that you marked).
How to fix this:
I assume this is part of AI’s animation blueprint so you should be able to TryGetPawnOwner and get it’s location.
I currently have code copied from Matt Aslpands Dynamic Footstep tut. And the Vector - Vector was only being used for the line trace so it’d understand what it’s walking on to swap the sounds up. That’s not where I’d put my AI’s location is it?
You need to understand what is going on in this logic:
TryGetPawnOwner gives you reference to the AI.
GetActorLocation gives that AI’s location in world
You do line trace from Start to End, so from AI’s location to 200 units under AI.
If this trace hit’s anything (for example ground) you play sound depending on surface type. What is important you play this sound in HitLocation. So if you were starting your trace from Player’s location, it was finding ground under the player and playing sound there.
I didn’t want to keep that tab opened too long, so I recorded a video to show you what I have now with what you showed me and maybe if you have anymore advice on this.
So I was able to get the sound working, it just now sounds like it’s in my ear when he walks and was wondering if there’s a way to isolate his foot steps to a radius around him?
Hi great that it works well now. To make sound hearable only for some distance you need to use Attenuation Settings. In Play Sound at Location node you can press that white arrow to get more settings and there will be Attenuation. By default it’s empty.