Does a Nav Mesh Vol need to be used with MoveToActor in an AIController?

Hi. I’m using Unreal 4.20.3.
I’m finding it a bit tough implementing MoveToActor on an AIController.
It doesn’t seem like it should be too complicated.

It’s a basic dogfight game where I want the Enemy planes to be possessed by the AIController and follow the Player plane.
In the EnemyPlane blueprint I set auto posses AI to “Placed in world or spawned”.

Initially I had APawn as the base class for the Enemy and Player planes but then I made it character.

In EnemyAIController I have the following code in BeginPlay:

if(GetWorld())

{

ACharacter* playerChar = GetWorld()->GetFirstPlayerController()->GetCharacter();

MoveToActor(playerChar, 1.0f, true, true, true, DefaultNavigationFilterClass, true);

}

But this doesn’t seem to be adequate the EnemyPlanes don;'t seem to head toward the Player plane and definitely don’t change direction when the Player plane moves in the world.

One question I had was if MoveToActor should be called just the once or does it need to be constantly updated eg. in Tick.

The other thing I was wondering is if a Behaviour Tree needed to be implemented in this setting - i haven’t really used them before.

Thanks.

J

Yes. The MoveTo nodes try to find a path using whatever Navigation System the world is using. By default, this is the engines only navigation system NavMesh - which naturally doesn’t work very well for planes flying around in 3D space.

It generates a path request, generates the path, then passes that to the PathFollowingComponent of the Controller. This component then calls RequestDirectMove or RequestPathMove in UNavMovementComponent, so you can create a movement component which inherits UNavMovementComponent, then it’s up to you how the movement component follows that path.

I believe the is a node called ‘MoveDirectlyToward’ - which just creates a path with the start and end points I believe. If you want true 3D pathing, you will have to create a custom Navigation System that replaces NavMesh. Easier said than done of course, but the option is there.