# AI Character twitches/jerks when walking

**URL:** <https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219>\
**Category:** Character & Animation\
**Tags:** ai-navigation, twitch, unreal-engine, question\
**Created:** [January 28, 2017, 2:07pm UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219 "2017-01-28T14:07:32Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pseudocorpus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pseudocorpus/32/453689_2.png) [@Pseudocorpus](https://forums.unrealengine.com/u/Pseudocorpus)\
**Post date:** [January 28, 2017, 2:07pm UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/1 "2017-01-28T14:07:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![shotty46290](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shotty46290](https://forums.unrealengine.com/u/shotty46290)\
**Post date:** [January 28, 2017, 2:13pm UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/2 "2017-01-28T14:13:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Pseudocorpus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pseudocorpus/32/453689_2.png) [@Pseudocorpus](https://forums.unrealengine.com/u/Pseudocorpus)\
**Post date:** [January 28, 2017, 8:46pm UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/3 "2017-01-28T20:46:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![shotty46290](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shotty46290](https://forums.unrealengine.com/u/shotty46290)\
**Post date:** [January 28, 2017, 10:29pm UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/4 "2017-01-28T22:29:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Pseudocorpus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pseudocorpus/32/453689_2.png) [@Pseudocorpus](https://forums.unrealengine.com/u/Pseudocorpus)\
**Post date:** [January 29, 2017, 4:18pm UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/5 "2017-01-29T16:18:52Z")

</div>

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”

 ![124058-bt_graph.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/2/4/124a5f66517b5f8514f6cfbd3d7b3e9c8bacf5a6.jpeg)

---

<div class="post-metadata">

**Author:** ![shotty46290](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shotty46290](https://forums.unrealengine.com/u/shotty46290)\
**Post date:** [January 30, 2017, 12:22am UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/6 "2017-01-30T00:22:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Pseudocorpus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pseudocorpus/32/453689_2.png) [@Pseudocorpus](https://forums.unrealengine.com/u/Pseudocorpus)\
**Post date:** [January 31, 2017, 6:17pm UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/7 "2017-01-31T18:17:23Z")

</div>

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

 ![124330-screenshot00105.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/4/5/14547c423e45e3cb27be6df4975782c7508bea80.jpeg)

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”):

 ![124342-ag.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/7/b/e7b81b54741596e87076bb9eab4f8e421b41a743.jpeg)

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

---

<div class="post-metadata">

**Author:** ![shotty46290](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shotty46290](https://forums.unrealengine.com/u/shotty46290)\
**Post date:** [February 11, 2017, 7:54am UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/8 "2017-02-11T07:54:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Pseudocorpus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pseudocorpus/32/453689_2.png) [@Pseudocorpus](https://forums.unrealengine.com/u/Pseudocorpus)\
**Post date:** [February 11, 2017, 11:26am UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/9 "2017-02-11T11:26:34Z")

</div>

No problem.

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

Anim Graph:

 ![125836-setspeedvariable.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/5/2/752e743edda184c555a2bdbace82a7afeaefa40e.jpeg)

Anim State Machine:

 ![125838-blendspace.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/e/8/2e847f6efd39ae59aeb970c82e4bf64d33b01339.jpeg)

---

<div class="post-metadata">

**Author:** ![shotty46290](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shotty46290](https://forums.unrealengine.com/u/shotty46290)\
**Post date:** [February 12, 2017, 9:01am UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/10 "2017-02-12T09:01:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Pseudocorpus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pseudocorpus/32/453689_2.png) [@Pseudocorpus](https://forums.unrealengine.com/u/Pseudocorpus)\
**Post date:** [February 12, 2017, 6:17pm UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/11 "2017-02-12T18:17:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Pseudocorpus](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/pseudocorpus/32/453689_2.png) [@Pseudocorpus](https://forums.unrealengine.com/u/Pseudocorpus)\
**Post date:** [February 13, 2017, 12:25am UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/12 "2017-02-13T00:25:12Z")

</div>

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!

 ![126027-lerp.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/c/1/cc12ba3ef753e323734d691e7cedf7b0dd66c9bf.jpeg)

---

<div class="post-metadata">

**Author:** ![shotty46290](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shotty46290](https://forums.unrealengine.com/u/shotty46290)\
**Post date:** [February 14, 2017, 6:30am UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/13 "2017-02-14T06:30:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Erempen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Erempen](https://forums.unrealengine.com/u/Erempen)\
**Post date:** [June 19, 2017, 8:49am UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/14 "2017-06-19T08:49:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mihovil](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mihovil](https://forums.unrealengine.com/u/mihovil)\
**Post date:** [September 22, 2017, 1:11pm UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/15 "2017-09-22T13:11:17Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![SkaveRat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SkaveRat](https://forums.unrealengine.com/u/SkaveRat)\
**Post date:** [November 27, 2017, 1:59pm UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/16 "2017-11-27T13:59:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Crazy\_Rabbits](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Crazy\_Rabbits](https://forums.unrealengine.com/u/Crazy_Rabbits)\
**Post date:** [March 16, 2019, 12:36pm UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/17 "2019-03-16T12:36:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Crazy\_Rabbits](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Crazy\_Rabbits](https://forums.unrealengine.com/u/Crazy_Rabbits)\
**Post date:** [March 17, 2019, 3:34am UTC](https://forums.unrealengine.com/t/ai-character-twitches-jerks-when-walking/383219/18 "2019-03-17T03:34:25Z")

</div>

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.
