AI move to

So I tried making an ai that simply follows you when he sees you, but it doesn’t really work…
when I test it just stays in one place and it just rotates towards me. Here’s the code I have in the enemy blueprint:


If you need any further information feel free to ask me.
Thanks in advance.

I assume that you have a NavMesh setup in your level and your actors are within the reachable ranges in that navmesh? Might be a dumb question, but just in case…

Yes. You are assuming right.

Did you add the NavMesh? Edit: Check

Did you add PrintString after OnSuccess and OnFailure to see which one fires?

I assumed its working and I just messed something up because well:


please don’t mind the poor-looking character model.

What is the movement result returned by the move to?
grafik

I assume I have to promote “Movement result” to a variable?
even if not I did it:

add a Print Text node and connect the Movement Result pin on the Move To to the Print Text, so you can see what the actual result of the call is

This one should be sufficient: it should print Success one time…

grafik

Hey, destination (orange pin) could you get your character’s world location to destination ?

When I’m really close it says success and when I’m far it says aborted.

I think, that the result is not really reliable on the upper execute pin - at this point, it only returns a cached result from previous runs. So, better print the movement result values you get from OnSuccess and OnFail as well.
If you see abort, this means that your AI does not have a path to your player character.
How does your navmesh look like?

That’s my NavMesh:

This looks ok. Did you change any values in the Movement component? For example, setting max acceleration or movement speed to 0 could cause movement to stop.

Another thing, although I don’t believe it is related to that: I do not use the pawn sensing, but work with AI Perception instead. If you just trigger the AI MoveTo by a simple keyboard press event instead of the follow player logic: for debugging, reducing things to minimum is always a good idea.

So I did find the solution and it was from the capsule component… apparently, it was too small and my character was in a T pose and he was going out of the capsule so I made him smaller and it worked… but it’s not really a challenge if he is the size of your foot. so do you know a way to make the capsule bigger without making the mesh bigger too?

Hmm, that’s strange. Of course, you can change the capsule just in the mesh editor:

Here, in the details you can set capsule half height and radius

grafik

But, i don’t believe, that this has any influence on the ai movement. My model bounds also go outside the capsule, but it moves. What I see in your video is, that the character seems to float a little bit above ground. Might be, that with your changes this also changed and that this causes the trouble.

well, I just added some animations, and when its not t posing its working just fine.
Thanks for the help!