How can i make an enemy AI follow the character (2d)

im trying to make the ai follow the character but its not working, also the character collids with it and goes off the map how can i fix thaty ?

Hey @itsbtatalol! Welcome to the forums!

Can you supply us with some more information? Let’s focus on one thing at a time. How about some screenshots or snips of the AI’s current code? That way we can see where you’re at and know what steps you need to take from your current status :slight_smile:

it doesnt have any code rn

just added the animation to it

first place a nav mesh volume from the place actor tab on the map
scale it to cover the whole level
and
here is the full code for the ai

Okay then!

Try this:

Use “GetPlayerPawn” instead of get Player Character,

Also you can plug it in to “Target Actor” instead of using actor location and see if that works. Does your zombie have pawn movement?

What exactly is happening vs what you want to happen? Is it moving at all, the wrong direction, etc.?

its not moving and i think thats because im using a paper blueprint and no it doesnt have pawn movement

No worries @itsbtatalol! It is going to need either a CharacterMovement component or a PawnMovement component, take your pick for this. Otherwise it will have to be coded in C++ and I don’t think you’ll want to do that!

Add one of those and use the code above we talked about based on Kkrkunal’s snippet. :slight_smile: