3D AI pathfinding in real 3d space (again)

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

Hello all,

unfortunately I have to ask again, because the topic is very complex and the right question influences the quality of the answers even more.

I had asked before, how to realize a 3D pathfinding with flying objects in a 3D space. A good answer was to use the built-in pathfinding. This works quite well, but more or less only 2.5 D, not really 3D. The problem for me is always the Y-axis (up/down) to a target point. The functionality built into godot via NavigationNavigationMeshInstanceMeshInstance works quite well if smaller height differences starting from the ground have to be overcome. In a 3D scenario without any ramps or structures over which a baked map is placed, this does not work.

Another issue is, you can’t seem to draw the path spline smoother.
In some situations it looks unnatural, for example when a bird flies from point A to point B and has to fly around another object. If it flies linearly to 5 points to reach its destination, it looks at least strange.

I found an example for Unity and I am interested if this can be implemented in godot at all?
In the example you can see exactly what I mean.

Thanks for reading and a good start to the new week to all.


This is not pathfinding. Its collision avoidance.
Godot have raycasting:
Its simple solution and as you see in video you have provided its easy to implement.

Asariuss | 2021-06-28 17:38

Can you form a concrete question?

sash-rc | 2021-06-28 16:27

Thanks for reading first.

Specifically, the question posed above is whether pathfinding (or raycasting) can be implemented in godot as in the Unity example. That is, whether you can have a 3D object find a path to any position on any axis and fly to it.

Navigation->NavigationMeshInstance->MeshInstance works really well in fairly flat settings, but not so well when there is no ground for the mesh to span limited polygons.

As shown in the Unity example, I’m looking for a way to move an object to another object - but not a linear movement but a bit smoother and maybe draw the path in the process.

Does this work like this (as shown in the Unity example) at all in godot?
I would also be willing for a donation if I get a simple example project, because the topic is not trivial and apparently not without reason almost nothing useful to godot is to be found on the Internet (apart from 2D pathfinding).

As described, like in the example I would like to be able to move an object from A to B. I like godot but just can’t find a way to use it in the 3D setting I need.

Holm | 2021-06-28 17:38

Thank you for pointing this out.

Unfortunately, I am still new and inexperienced in godot and do not know how to use raycasting based on the documentation. I haven’t found any examples either (except 2D).

Holm | 2021-06-28 17:54

:bust_in_silhouette: Reply From: Holm

I have found a solution that works well for my use case. Thanks to all readers and helpers.

So, what this solution was like?

Dingo | 2023-06-06 14:09