I wrote a simple test AI for a character; and all that it should do is to be idle while a parameter is below threshold; otherwise it should perform actions based on other parameters.

So for example

if X< 0.5 --> Idle state
   if A > 0.3 --> go to point A and perform action A
   else if  0 < A < 0.3 --> go to point B and perform action B

I do have the code for the AI state machine in place; but now I am stuck about how to build the animator that goes with this AI. I did use the standard AI 3rd person prefab in Unity; and it moves correctly, since the controller script has the logic for moving already integrated; but how do I make the entry for action A and B?

Do I add the animations in the blend tree of the animator, and then from the AI script I call the animator play function for a specific animation? Do I set parameters for such animations so when the variable X and A change; the blend tree read them directly and transition automagically?

All that I can find around is just the usual AI examples for FPS; which use the same patrol-chase-investigate sequence; but they are mostly moving or chasing; not necessarily executing different animations.

Any suggestion would be more than welcome

| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.