0
\$\begingroup\$

I'm new to game development and to Unreal but I cannot for the life of me get my AI character pawn to move at all using any method I know.

I'm developing a 2d Sidescroller game using a Tilemap. I have made sure collision is set up with the map and tiles, the player character can interact with it all just fine, and I made sure to widen the collision thickness of the map so that the navmesh can properly appear (as seen with the green areas).

Nav Mesh loading. AI spawns in the air and falls down so I know he isn't overlapping with the ground Nav Mesh loading. AI spawns in the air and falls down so I know he isn't overlapping with the ground

I've disabled and enabled collision for the static mesh cube component in the character pawn, but he still doesn't move. The goal is to get him to follow the player when he sees him. The pawnsensing trigger works just fine, as I had it print whenever he sees him, and he even properly gets to the point of executing the "follow player" function (the print statement works).

However, using AIMoveTo fails every time. I've tried putting the player as the target, the player's worldLocation as a vector, and even an arbitrary point vector to the right of the AI but AIMoveTo fails every time.

I've deleted and replaced the NavMesh, and I've even tried completely skipping using AIMoveTo and just using Add Movement Input in both the AI Thinking Blueprint and Character Pawn Blueprint but neither make it move. I literally put an Add Movement Input function on the Pawn's event tick but it never moves.

Any suggestions?

Code: AI Logic event is triggered every tick AI Logic event is triggered every tick

Character Pawn Tick (for debugging). Does not cause the Pawn to move Character Pawn Tick (for debugging). Does not cause the Pawn to move

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

To move the AI on a navmesh, you need a behaviour tree, a blackboard and an AI controller (BP).

At the AI Controller you need to run the behaviour tree:

enter image description here

In the BehaviourTree you need a new custom task and move to:

enter image description here

In the BehaviourTree you can create a new task; in the task, you need to set a blackboard value, which is editable:

enter image description here

And in the blackboard you need a new key which is edited by the task:

enter image description here

And the AI controller must be the controller of your BP_Character in the Details.

Hope this helps you :)

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .