Gliding AI: how to?

Hello everyone,
I’m developing a game with character able to jump and glide through the air for long distances. But I am completely lost on how to make the AI work.
As long as it is on the ground, a simple NavMesh works great, but as soon as it jumps, I can’t make it work: without the support of the NavMesh below, it simply stops moving and gently falls back to the ground. How can I control its movement while falling?

I tried:

  • several types of BP nodes, ranging from “add impulse” to “move to”, but none of them worked for me.
  • The Don’s 3d navigation plugin, but (for some reason) it crashes my editor as soon as I hit play. Moreover, I don’t know if it would work with jumping characters, instead of flying pawns.

Any idea is well appreciated, I have tried anything that came to my mind. I don’t think I’m experienced enough with c++ to create a whole new navigation system. Thanks in advance to anyone willing to help!

You can use the Add Movement Input node to make your character move into a specified direction. And as long as your pawn’s Character Movement Component has its Air Control value set greater than 0, the pawn will be able to change direction and move while mid-air. (I recommend setting this value closer to 1, at least for testing.)

As for telling your character how and when to use ‘flying’ movement while jumping, you can probably use the Character Movement Component’s Is Falling node (or alternately its Is Moving on Ground node) to determine whether the character is in the air after a jump. If it is, you can direct it to use your ‘flying’ behavior in place of the regular navigation, which stops once the pawn goes airborne.

The tricky part is figuring out where the pawn needs to aim while flying/falling to help it reach its destination. This might be easy, or it might be hard, depending on how complex your level is, and how long your pawns remain airborne (compared to how much time they spend on the ground).

If your level is simple, and if your AI pawns don’t spend half their lives flying or falling, you can probably just try a simple aim-at-final-destination approach. Basically, {Final Destination} - {Current Location} = {Direction Toward Goal}. You could create a vector like this, normalize it, and then feed this vector in your Add Movement Input node. Then allow the pawn to resume normal navmesh pathfinding once it lands on its feet.

Anyway, that’s one untested, unproven, and messily explained approach. But hopefully you can make some sense out of it and maybe get an idea or two for how you might take a few more steps forward.

That was super helpful, thank you kindly.
The “Add movement input” node is exactly what I was searching for, works exactly how it should.
My characters spend a lot of time in air, so I will try to create something clever to feed them their destination. They have to move in a complex environment, so I’ll have to manage obstacles, walls and pitfalls. It will be hard.