Debugging unexpected stop behavior

MarkusKer

Member
Hello,

i am currently altering the demo Behavior tree to fit to the behavior of an zombie. It is coming together pretty well but the AI now seems to stop for a second if it is chasing me. This happens if i am further away and change my position. When this happens the Animators forward state is set to 0 for a very short amount of time causing this problem.

Do you guys have any idea?

Thanks,
Markus
 
This is extremely tough to say without getting into it and debugging the tree. My best advice is that once you have a basic understanding of the integration tree, you should start from scratch with a new tree for your AI. You can add the tasks one at a time, and this will allow you to know exactly what is going on. It will also point you to where any problems are at since you'll want to test it after you add a block of tasks.
 
Thank you for that information:)

I have done some debugging and i came to the conclusion that it is unrelated to the behavior tree. I set up a new one with the only task to follow the player. If i than move infront of the AI from left to right, it seems to pause the forward animation for a second.
 

Attachments

  • DEmo.zip
    250.6 KB · Views: 2
I would try something even easier - does seek work? If it does, now seek to multiple locations. This is basically what follow is doing so if seek works with multiple locations then follow should as well.
 
This also happens if i use seek. I am guessing that it has to be in connection with the turn speed or something. This is also happening in a completly new scene and having nothing changed. It can be reproduced in the Demo Scene as well. If i create a new AI Agent and let it seek an object and i than move the object infront of the AI from left to right the Forward speed drops to 0 for a second. Well actually it drops to 0.8 because of the Animator Monitor Damping. But if we turn those balues to 0 it is clearly noticable that the agents stops for a second. Maybe there is somekind of path recalculating issue involved?
 
I took a second look at things and was able to find out that the animator values "moving" and "forward movement" are set to 0 and not true for a second as well.
 

Attachments

  • debug.PNG
    debug.PNG
    10.5 KB · Views: 4
What I suspect is happening is that as you move the target object your agent is getting close enough to the destination so the seek task stops. When you then move the object away it is then further away so seek starts back up again (assuming the tree is still being evaluated).
 
Even if the object is very far away this is happening. It looks like this is happening everytime the agent has to take a turn.
Even if it is an very small turn.
 
I just tried to reproduce it within the Behavior Designer sample project but I wasn't able to. This is on version 2.2 but I don't think that this would affect it.

When the seek position changes it does recalculate the path. If you place a breakpoint within NavMeshAgentMovement.Update method you could debug why the InputVector is being cleared out.
 
That looks like it could be caused by root motion. Try disabling root motion on the Ultimate Character Locomotion component.
 
I checked that aswell. Root Motion is turned of. Where are the Moving and forward parameters beeing set? I could try setting breakpoints.
 
I have now created two new projects . One is created with the last official version of unity 2019.3. I only imported the Third Person Controller, the movement pack and behavior designer with the integration. The problem really can be reproduced easily. The Demo Agent is also suffering from this behavior. The Movement gets stuck for an very very short amount of time.

 
From your video I didn't notice the movement stopping at all. It looks like the agent continues to move?
 
Please take a look at the Animator states. It is noticable that the movement bool is unchecked for a very short amount of time. At exactly that moment the agent stops.
 
Top