unity-movement-ai icon indicating copy to clipboard operation
unity-movement-ai copied to clipboard

Combining behaviors?

Open frozen-banana-123 opened this issue 3 years ago • 0 comments

Hi! I've been having a lot of fun using this library. Thanks for sharing your great work! I'm working on making a sports game and have been considering using this library as a basis for the movement AI. I've been trying to combine different behaviors, but am having trouble getting it to work.

For example, I want to have a game object use both Arrive and Evade at the same time. Imagine a football player running towards the end zone, while also trying to move away from an incoming defender that gets close. I've seen other movement AI tutorials that use the concept of "blending" or "weighting" behaviors, so that you can combine different behaviors and give priority to one behavior over another. Sticking with my football example, I want the players top priority to be running to the end zone, but slightly changing course to try and put separation between him and an incoming defender.

I've tried adding in a "weight" variable to behaviors, and in the SteeringBasics "Steer" function, multiplying the weight by the existing "linearAcceleration" variable. I was hoping to achieve blending multiple behaviors like this, but haven't had any luck in getting it to work.

Has anyone been able to achieve blending multiple behaviors in any sort of way? Or is there something already built in to this library that would help me do this, and I have just plain missed how to do it? Any help would be greatly appreciated!

frozen-banana-123 avatar Nov 15 '20 19:11 frozen-banana-123