News Forums RAIN General Discussion and Troubleshooting Is there a good way to stop AI from moving when they're running their animation?

This topic contains 5 replies, has 3 voices, and was last updated by  Sigil 1 month, 1 week ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #39336

    wightwhale
    Participant

    Currently I have AI sliding while they’re attacking is there a good way to make the AI stay in place during the attack animation?
    http://i.imgur.com/179sXuv.png

    #39347

    Wipster
    Participant

    I think this is what you are looking for, isn’t it?

    http://docs.unity3d.com/Manual/RootMotion.html

    #39349

    wightwhale
    Participant

    No my current ai code in the image makes the AI run right when the AI is any distance from the player. So the second the player is out of range the ai starts moving closer again instead of finishing their attack and then beginning to move again.

    #39350

    wightwhale
    Participant

    I put in a timer which seems to be working now.

    #39352

    Wipster
    Participant

    Ah okay, you could still have a look at rootmotion. AI will never slide when you use it. It’s actually a great feature of Unitys animation system. Also no slipping feet anymore :)

    #39354

    Sigil
    Keymaster

    Generally I use a timer if the animation can be interrupted, like a looping animation of some kind: idle, look around, etc. For animations that can’t be I most often end up in a Custom Action to handle it.

    The main reason I use a Custom Action in this case is that I almost always pair my attack with some custom code to handle damage, or to line up the damage with the animation. Check out this thread for a more detailed behavior tree, with an attack that used a custom action.

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

You must be logged in to reply to this topic.