Shaking enemy after ading code from lecture 51 to the AI script

Hello :slight_smile:
I hope you have nice day!

I have here some weird behaviuour. After adding portion of code from lecture 51 to AI.
During suspicious and after come back to guard possitionw when the enemy should idle, animation is shaking.
It looks like Idle and Walk are changing very quickly during that time.
I thought it might be something with Action Scheduler but I cannot see what might cause the issue, any thoughts?

It looks like your forwardSpeed is in a place that has you between Idle and Walk, and there are a few spots that don’t blend well between those animations… you might try increasing the patrol speed to match the blend speed you’re using for walk.

Hi Brian!

It looks like the forward Speed cannot be zero after it was greater than zero at least once during play.
So it means that enemy can “idle” only on the begining of the game.
And only if he is not patroling the path… so no “mover” script was run on him yet…
Enemies who have patrol paths have same issue during “dwelling” state from the begining.

So it looks like the issue occurs in those moments:


I also noticed that all enemies have stopAttack as true from the beginning, should it be this way?

This may be an issue with the NavMeshAgent trying to get to the exact position, but unable to reach it.

Try adding this to Update() in the Mover.cs script:


And in MoveTo() add:

1 Like

Thank you ! It worked!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms