About pathfinding in 3D

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

How does we implement obstacle avoidance dynamically in Godot 3D? From what I have searched so far it seems like it is not possible to do so till Godot 4.0 is released.

But even then, I want to learn about pathfinding, as I want to implement some of the path movements like in games such as Age of Empires and Total War, where there are these cool formations and a lot of other things.

But I am kind of confused about terminologies related to pathfinding. As most of the tutorial I see online are related to A* algorithm which I believe is a path finding algorithm, but it turns out that there is some other technique used for avoiding collision among moving enemies. I guess we call it obstacle avoidance?

Either way, from where can I learn about these things. Are there any good free resources out there on internet. Or is there any good books or something. I really don’t know where to start. Any advice is greatly appreciated. Thank You! :slight_smile:

:bust_in_silhouette: Reply From: Magso

I tried making obstacle avoidance by altering the get_simple_path points directly. Here’s a GitHub link to it. I also posted a small demo on Reddit but the video only plays on desktop.

I saw your demo video and it is working really good. Though it looks like it will take me some time to understand the code properly. As of writing I haven’t read it thoroughly though. But at the same time, how are you implementing obstacle avoidance. And what resources would you recommend me to understand more about how to implement obstacle avoidance. Because on internet I don’t see enough results, except for many many research papers ( which looks really intimidating to me lol ). Or it could be also that I am putting the wrong keywords in search.

Right now though, I am fine tuning my knowledge of pathfinding algorithms like A* and some other. And my end goal is to be able to have a system like in Age of Empires/Total War games, where units move in a specific formation and also avoid obstacles along the way (static and dynamic both).

Skyvastern | 2020-11-08 13:42

My approach to it was like I mentioned above ‘by altering the get_simple_path points directly’. It iterates through each agent’s path points and finds the points within its radius. For each of those points it calculates where that point would go and uses intersect_ray to check if there’s anything in the way, if so it checks the other side and moves the point accordingly.

I didn’t study any kind of pathfinding or obstacle avoidance to make it, I just had an idea of how to go about making it in gdscript. However because obstacle avoidance isn’t eccentric to any particular engine I’d recommend looking through sites like Stack Overflow because that won’t be as intimidating as a research paper or manual.

Magso | 2020-11-09 00:28

Thanks for the information. That helps a lot :slight_smile:

Skyvastern | 2020-11-12 04:37