How can I make that the enemy follows the player in a 3D space using Navigation and NavigationMeshInstance:

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MxtApps

Hi,
You only need to look at the title to know what I want.
In Youtube I found some tutorials about how can I do this, but I believe that they are obsolete, because these videos do not work in my godot engine.
So, I know that the Navigation get_simple_path function returns an array of points between the given positions, which can be got by calling the global_transform.origin of any 3D node. But I want to know how I can use the given array and use it in the current versions of godot engine and in Godot 4.
I use GDScript
Thanks in advanced.

:bust_in_silhouette: Reply From: sash-rc

There’s a “3D Navmesh Demo” stock template project, which demonstrates a navigation.
In that project character plots a path to randomly clicked target point (Vector3).
In your case you should change this target to your player’s position.

It does not work, happens the same that in the other tutorials.
You have a WORKING code for this?

MxtApps | 2021-07-03 17:36

Said sample works for me.
Please be specific, what kind of error message do you get?

sash-rc | 2021-07-04 07:53

But for meke the enemy follow player?

MxtApps | 2021-07-05 12:56

Ok thank you for the information.

MxtApps | 2021-07-13 11:58