AI Character twitches/jerks when walking

I recently started working with AI, Behaviour Trees and Blackboards. I followed the Basic AI tutorial by Tesla and got it all working so far.

Now the character twitches here and there when he walks. It is like he is trying to get to another animation just for a quarter of a second or so. Sometimes it occurs multiple times in a row and is therefore really apparent.

Has anyone encountered this kind of problem before?

Thanks in advance.

Have you looked at your tree during run time? Does it have hardcore flicker?

Hey shotty46290,

thank you for your answer.

If you mean by “flicker” that it quickly switches from one task to another, then no… but is seems like the “points”, which indicate the direction of execution are lagging a little bit when the the animation is stuttering. But they stay on the “Move To” node the whole time.

Have you played it with the AI debug on? To see if you can find anything not going correctly in there

And a side note. Is the AIs only objective to run to a random location? Or do you have more in it than that.

How do I turn on AI debug? Because typing “show debugAI” into the console doesn’t seem to do anything.

Basically I have two tasks: “FindRandomLocation” and “MoveTo”

Ai debug is turned on during runtime by pressing the ’ key, and it also has some other functionality as well. If you look above the basic data screen when that comes up. You will see a text of commands to see more data.

I can’t see any problem in my Game debugger:

The Problem seems to be the Speed-Value I am feeding into the Blendspace inside the AnimGraph. It is calculated this way (inside “Event Blueprint Update Animation”):

That means that the pawn probably moves in a “stop and go”-way. But I don’t know why. :-/

Sorry for the delayed response in the middle of a move and have no network right now. What are you doing with his velocity inside that blueprint?

No problem.

It is used to set the speed variable which is being fed into a blendspace inside my Animation State machine.

Anim Graph:

Anim State Machine:

Is your navagation mesh static or dynamic? Does his velocity get higher than your max blend space? If so he might be trying to reset his speed. And also does his path re-adjust when hes doing this glitchy movement?

My navigation mesh is dynamic due to the size of the map.

The speed shouldn’t get higher than the blendspace. That is the weirdest thing. When he runs, the glitches don’t appear. Only when he walks. When previewing inside the blendspace, there are no issues either.

As far as I can tell, he doesn’t re-adjust his path during the glitching. This happens while he is patroling. The Behaviour tree only finds a random location and then sticks to the “Move To” node until he reaches his destination.

I’ve plugged in a lerp to set the speed variable a little bit more softly. This seams to smooth out the AI’s movement. Thanks for your help, mate!

No problem glad to help sorry again for the delays. Make sure to mark the question answered so its not in the unanswered section

I finally figured this out! The problem is your Mesh is affecting the dynamic navigation map. Make sure on your mesh or whatever has collision “Can ever affect navigation” is UNchecked. Then the twitching should stop.

I’m having the same problem as stated above. It happens when i use dedicated server and the blendspace is feeded jerky speed values. Is there any other solution to this other then the LERP thing?

LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Client 1: 0.0
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Server: 0.0
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Client 1: 0.0
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Server: 6.652144
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Client 1: 0.0
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Server: 13.098841
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Client 1: 0.0
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Server: 19.744646
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Client 1: 0.0
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Server: 26.475044
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Client 1: 18.308191
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Server: 33.041145
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Client 1: 10.093934
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Server: 40.107269
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Client 1: 0.0
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Server: 46.554752
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Client 1: 37.166431
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Server: 53.065929
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Client 1: 27.588448
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Server: 60.174667
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Client 1: 19.339079
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Server: 66.74826
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Client 1: 56.284946
LogBlueprintUserMessages: [MyMixamoAnimBP1_C_0] Server: 73.124046

■■■■, thank you. In my case it was a weapons mesh that affected the mesh even if it’s the the characters hands

May AI walks and twitches. It seems that the map is too far away from the origin of the world. I am also looking for a solution.

I have the same problem as you.How did you solve it?It seems that the map is too large to deviate from the origin of the world.