Is it possible to use A*pathfinding for flying enemies?

  • A* version: [5.4.7 ]
  • Unity version: [Unity 6.6]

Hello I am using A* Pathfinding Pro with Unity for my enemies and it works great but now I want to create flying enemies that flies around and shoots orb at me is it possible to do it via A*Pathfinding and how?

Hey, for flying behaviour I would sugggest you just do steering with a raycast. The A* Graphs capture the “Surface” of the world which means there are no nodes in 3D.
Depending on your game you could also just fake it, create a layer with custom geometry over your surface and then create a “flying” graph where the enemys move along, hide that geometry after baking the graph - although they would then be Y-axis restricted.
Another way is just having pre-made flight paths (like in a tower defense game).
Or faking the flight by having the enemy offset to the ground in the y position by either animation or detaching the agent from the enemy, using the agent only for pathing and then set the enemy transform to agent + y offset.

I hope that helps a bit^^

2 Likes

There’s also point graphs! I like to mention those for flying as well when it comes up, but be warned they aren’t supported on FollowerEntity.

1 Like

Thanks for the tip!

Yeah I end up faking the flight by offseting the Y value. Looks good.

1 Like