My AI won't swim/fly up, always moves along the floor

Hello everyone,

I have set up an AI fish that I want to swim around in a water volume. I have it all set up right (as far as I can tell) but when I use AI move to or Simple Move To nodes, the fish just moves along the floor of the navmesh and won’t go up. It goes to Y coordinates correctly (it’s 2D so X is always 0), but it will never move up on the Z plane. If I switch its movement mode to flying, I get the same problem.

What does work is when I set the AI to follow my player character, who is also swimming. If it is set to move to an actor rather than a vector, it can move up and follow correctly. But for my game, I really need it to be able to move to a vector point as well.

I have checked the AI’s movement mode and it is indeed always Swimming (or flying when I was trying that). I have set the “Vertical Deviation from Ground Compensation” value in the RecastNavMesh to be 1000, but it still refuses to move up off the ground! I’d really appreciate any help on this one.

Navmesh and navmesh paths following is essentially 2d. If you want your AI to move in full 3d you’ll need to tell it to move in straight paths, without navigation pathfinding. Obviously with this approach AI won’t avoid obstacles.

Cheers,

–mieszko

Hi Mieszko, thanks for your reply. Since I’m making a 2D game, would it be possible to change the 2 dimensions that the navmesh uses to Y and Z rather than X and Y?