Flying/Floating Enemies (i.e. Doom's Cacodemon)


I’m a ‘shoot first ask questions later’ type of guy. I just bought A* Pro in the hopes that it would solve my floating AI dilemma. Basically I don’t know of an easy way to have AI float in the air, avoid obstacles, and target the player in a similar fashion like a flying drone or some of the floating enemies from the classic Doom series.

I’m surprised how little of this I am finding when looking up A* tutorials on how it handles objects moving in open 3D space. I would imagine A* could do the job but not sure how to get it started. Could someone point me in the right direction? Thanks!


3D pathfinding is generally not something that this package does. Note that enemies that just float a small distance above the ground but otherwise moves similarly to other ground based units are essentially also ground based. They do not need special pathfinding.

It is possible to do 3D pathfinding with a point graph (see example scene 5). You will have to create nodes for each point in space that you want your AI to navigate to (ideally relatively sparsely). For best movement quality I think this needs to be combined with some game specific movement behavior as straight point to point movement will look unnatural for a flying unit.

Thanks for the reply!

So A* isn’t designed to handle the path finding for objects moving through 3D space eh? The idea was that I would have flying mobs spawn in random points open 3D space. From there they would either directly target the player (if close enough) or just randomly float around. The game would have platforms/islands in the sky the play would walk on and the flying mobs would spawn both below and above the platforms.

Would this still be possible with nodes or is it simply something A* would be unable to handle? If not do you have any recommendations to make this possible? Either way A*t still looks like an awesome path finding AI for ground based units and I’m looking forward to using it!

Generally 3D pathfinding as in making a 3D grid is veery memory intensive and slow. (I have done it previously for another game, but due to memory usage the graph couldn’t get very large at all). The benefit of 3D space is that the world is usually very open, so often it works really well with some kind of steering behaviour (e.g fire a few raycasts ahead of the agent and change direction slightly to try to avoid obstacles). Usually steering yields much smoother movement compared to 3D pathfinding as well. The downside is that it can only handle convex obstacles well. Combing a coarse point graph with a steering behavior will give you the best result, but I would recommend starting with only a steering behavior.

I understand, thanks Aron!

I also have a problem with flying units. I was also thinking about 3d grid. Can it be made with a custom graph ?

A common solution for this desired behaviors is something like Octrees.

Yes, you can make a custom point graph to accommodate flying units: SOLUTION: Flying unit pathfinding!