News Forums Troubleshooting Changing animations

This topic contains 2 replies, has 2 voices, and was last updated by  Snuffles10155 10 months, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #7878


    I am currently using legacy animations for my AI and have a walk, idle and run animation. However I cannot get the animations to change and what I have found is because these animations loop, the tree always gets stuck on them and cannot progress.

    For example playing walk animation while moving to a waypoint, the walk animation repeats forever even though I have set it to repeat never.Because of the AI never reaches the move node. I tried putting them both in a parallel node but then the sequence of walk to a node, then wait and repeat doesn’t work. Below is a screenshot of my current tree, using the parallel node to at least play the walk animation while moving to locations then waiting a random period.

    The animation also does not ever change properly such as in the scenario where the player is detected the run animation does not play, if I also turn off in the animation settings for my model the auto play checkbox and remove any starting animation no animations play or change which suggests something is not setup there correctly even though when running the behaviour tree does not report any errors so it would suggest its finding the animation states correctly. Below is a screenshot of how my animation component looks on my model at the moment.

    Is there another way to setup the tree properly for controlling animations ? Such as monitoring a variable to decide which animation to play ? Or be able to see what the current speed of the AI is and react to that ? How would I set that up ?



    First, make sure you turn off Play Automatically on your Animation component.

    Animation nodes will continue to return running as long as the animation is playing. For a looping animation, that will be forever. The right way to deal with this is to have the container node in which the animation resides exit. For example, if you have a parallel with a move and an animate, and if your animation is looping, then you will want the parallel to return on Any.

    In your BT, it isn’t clear why the Walk animation should ever stop. If the AI is constantly moving, then it makes sense for the walk anim to keep playing. If the Constraint ever hits (Doesn’t see player becomes false), then it should drop down to your Spotted Player constraint.

    Of note, in the Spotted Player constraint, your move node is not repeating, which means that the AI will move until it reaches the player (presumably that’s what your move does) and then will stop moving completely (but won’t stop the run animation.) I suspect that isn’t what you want. Instead, get rid of the repeat forever on the Run, but set repeat forever on the move.



    Thanks prime that tip for the parallel returning if any child are true fixed that issue. As for the animations not playing the body for my AI was set to the parent object not the actual mesh body (this was for the previous requirement that was patched of having a parent gameobject for everything set to 0 in the y coordinates). So the animations work and change now.

    As for the detecting player section you are correct at the moment the AI just goes to the player and stops if it reaches the player which is fine for now I am still to setup the attack and damage parts of the behaviour (probably a custom action to affect the players health variable plus an attack animation should do the trick)

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.