Need help with creating a bee AI

Hi, Wondering if anyone can link me to a place where i can learn to make AI which acts like a bee. So it will fly around a certain area in random directions.

I am in uni and learning about unreal so anything will be much appreciated.

Thanks :slight_smile:

Hi, this could be useful for your use case: DoN's 3D Pathfinding for Flying AI in Code Plugins - UE Marketplace

There are two ways to establish AI movement, one involves Behavior Tree’s the other is to add movement functions directly to a character blueprint. The latter is also more convenient to handle when starting with Unreal Engine, since it only requires editing in one place (instead of several blueprints when using a Behavior Tree). I would also suggest to install DON’s pathfinding plugin, check the code then if possible use that without BT’s, and add functions to check if a flowering plant blueprint is near the bee actor.

Basically in a nutshell, if a flower is near the bee (is true) you could add a branch where you set the AI MoveTo node to randomly select a path destination very close to the flower, then run a timer on Event Tick (if IsFlowerNear? is true), so that after a given time is reached the bee switches back to a AI MoveTo with a larger random destination. To check for flower you could add a OnEventBeginOverlap sphere on the flower blueprint. To make this more natural you maybe also want the bee to land on the flower, which depends on how you establish movement, ie. via DON’s plugin. So you could set a TransformActor once the bee has been around the flower for some time, and once the bee is transformed to the flowering zone on that flower, it should stop flying, switch to some idle animation, or better yet a flowering animation, which could be triggered by a bool inside the bee blueprint, and then communicated to the bee’s AnimBP (Animation blueprint), so that the locomotion (movement state), switches (again via a bool), to the idle animation.

Open the Launcher to the to the **Unreal Engine > Learn **tab. Scroll down to the “Blueprints” project and download it. Open and play the project, and you’ll find a butterfly flying around. Its logic is made entirely with Blueprints, feel free to inspect and deconstruct it.

Cheers

Thank you guys. I have something working now.