Flying with Character Movement Components + Move to Location?

Hey there. I am trying to create a basic flying AI, but I’m unsure of how to get it working properly. I know how to get a ground AI working, but when I switch it’s movement type to Flying, Move To Location stops working - he just sits still. I know I could force the functionality that I want using blueprints but I wanted to get it working using the movement component so I can use the built in Move to Location and nav mesh.

Is that even possible? I’m assuming it is because there’s a flying section on the movement component. I just can’t get it working.

Thanks for any help

Well you did mention your issue.

I know I could force the functionality that I want using blueprints but I wanted to get it working using the movement component so I can use the built in Move to Location and nav mesh.

“Move to Location” is as you correctly realized depended on the nav mesh. You can make the nav mesh visible by pressing “P” when looking at your level. What you will notice is that it covers the ground. Which is exactly what it does. The nav mesh generates a map of walkable area on the 3D terrain you got. It does not create a 3D navigational map for every point in space but only on terrain. So once you start flying you leave that defined area, “Move to Location” has no valid nav mesh anymore and no defined behavior and will therefore stop working.

Move to Location won’t help you here.

Cheers

So basically I can’t use half the features of behaviour tree like move to or EQS?

That’s really unfortunate…

Those are not features of the behavior tree. Those are functions epic provides out of the box. All features of the behavior tree are available for your case.

I’m confused… so I CAN use Move To to make my AI fly to a location?

No. Epic provides some commonly needed decorators and services. Ready to go functions which work work the behaviour tree.

It’s not a feature of the behaviour tree though but merely some pre written code. Like the templates. They by themselves are not a feature of the engine but just some pre written code which utilizes the engine.

That was my point. The functions themselves are very general and in pretty much all cases in which you want a decent AI you will have to write your own code. Genetic functions like this just don’t do the trick for very specific cases.

Okay, I think I understand a little better. Things are just going to be harder than I thought. Which is understandable, I realize what I am asking for is a LOT different than standard nav.

Thanks

Erasio is spot on, just to add to what was said here are a few more tips:

  • You’ll need to create a behavior tree
    task which handles flight inside. If
    your air-space is largely empty this
    may be as simple as performing
    sweep/ray traces from your unit to
    destination and then using the task’s
    Tick node for driving the unit.

  • Epic’s own flying template actually
    uses a Pawn instead of Character and
    with good reason: Character’s flying
    mode can be tricky to work with and
    most units are better off with a
    simple flying Pawn instead of dealing
    with the custom physics/gravity
    constraints that the Character class
    imposes on you.

  • If your air-space is so complex that
    you need a full-blown 3D navigation
    solution, I’ve released a fully free
    plugin for flying AI/volumetric
    navigation
    that might be of help. It
    comes with a “Fly To” behavior tree
    node that you can plug straight into
    your behavior tree just like you
    would with “Move To”.

HTH

1 Like

i know this is an old thread but a workaround that i have for this is before giving the move to order (in the ai that you want to fly) you actually spawn an actor (just a placeholder) at that location and then use to move to location or actor (and use the actor reference) …and boom, you have flight for your ai, considering you made it so he can actually fly… i had done this originally for an eagle that is always flying but i also redid it for a sparrow that takes off from the ground (doing some BOTW type stuff when detected)…