# AI strafes when set not to

**URL:** <https://forums.unrealengine.com/t/ai-strafes-when-set-not-to/2327168>\
**Category:** AI\
**Tags:** ai-navigation, ai-controller, unreal-engine, Blueprint, question\
**Created:** [February 11, 2025, 10:23am UTC](https://forums.unrealengine.com/t/ai-strafes-when-set-not-to/2327168 "2025-02-11T10:23:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlackHole137](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlackHole137](https://forums.unrealengine.com/u/BlackHole137)\
**Post date:** [February 11, 2025, 10:23am UTC](https://forums.unrealengine.com/t/ai-strafes-when-set-not-to/2327168/1 "2025-02-11T10:23:25Z")

</div>

Hello, i’m setting up an AI for a dog that follows the player around. It works correctly except for one thing. The dog has a limited turn rate with different animations depending on how fast it’s turning. Both the controller and the Move To node are set not to strafe, however, when the dog isn’t facing the player the dog still strafes, moving directly towards the player and not in the direction it’s actually facing. Is this a bug with unreal or is there something i’m missing? Does anyone know a way to actually disable strafing?

---

<div class="post-metadata">

**Author:** ![PasMonVraiNom](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PasMonVraiNom](https://forums.unrealengine.com/u/PasMonVraiNom)\
**Post date:** [February 11, 2025, 11:15am UTC](https://forums.unrealengine.com/t/ai-strafes-when-set-not-to/2327168/2 "2025-02-11T11:15:54Z")

</div>

Do you have use controller desired rotation ticked in the dogs movement component?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/9/0/090125da72bfafe1eac535b8e0c7a3a8c2f53136.png)

---

<div class="post-metadata">

**Author:** ![BlackHole137](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlackHole137](https://forums.unrealengine.com/u/BlackHole137)\
**Post date:** [February 11, 2025, 11:42am UTC](https://forums.unrealengine.com/t/ai-strafes-when-set-not-to/2327168/3 "2025-02-11T11:42:26Z")

</div>

Yeah

---

<div class="post-metadata">

**Author:** ![PasMonVraiNom](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PasMonVraiNom](https://forums.unrealengine.com/u/PasMonVraiNom)\
**Post date:** [February 11, 2025, 11:52am UTC](https://forums.unrealengine.com/t/ai-strafes-when-set-not-to/2327168/4 "2025-02-11T11:52:38Z")

</div>

If you print out the rotation rate whilst the dog is following you is there perhaps a chance it’s being set to 0?

---

<div class="post-metadata">

**Author:** ![BlackHole137](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlackHole137](https://forums.unrealengine.com/u/BlackHole137)\
**Post date:** [February 11, 2025, 12:00pm UTC](https://forums.unrealengine.com/t/ai-strafes-when-set-not-to/2327168/5 "2025-02-11T12:00:13Z")

</div>

The rotation rate isn’t set to 0. The problem isn’t that the dog doesn’t turn, it’s that it runs in the wrong direction relative to itself. If the dog starts facing away from the player, it’ll turn to face the player over time but during the turn it runs directly towards the player, meaning up until it’s facing the player the dog runs backwards or sideways which it shouldn’t be able to do

---

<div class="post-metadata">

**Author:** ![PasMonVraiNom](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PasMonVraiNom](https://forums.unrealengine.com/u/PasMonVraiNom)\
**Post date:** [February 11, 2025, 12:12pm UTC](https://forums.unrealengine.com/t/ai-strafes-when-set-not-to/2327168/6 "2025-02-11T12:12:34Z")

</div>

Ahh I see. To my knowledge then this is expected behaviour, the dog isn’t strafing but simply turning towards it’s movement using it’s rotation rate. You could use set focus to make the dog face the player without moving and then clear focus and call AI move to.

---

<div class="post-metadata">

**Author:** ![BlackHole137](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlackHole137](https://forums.unrealengine.com/u/BlackHole137)\
**Post date:** [February 11, 2025, 12:26pm UTC](https://forums.unrealengine.com/t/ai-strafes-when-set-not-to/2327168/7 "2025-02-11T12:26:23Z")

</div>

Then it is strafing. I was going by this definition:  
“Strafing in video games is a maneuver which involves moving a controlled character or entity sideways relative to the direction it is facing.”  
The “can strafe” flag is very misleading since it seems like it only determines wether the character turns to face where it’s going and not wether it strafes. Do you know of any way to lock it’s movement so that it only moves along it’s forward vector?

---

<div class="post-metadata">

**Author:** ![PasMonVraiNom](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PasMonVraiNom](https://forums.unrealengine.com/u/PasMonVraiNom)\
**Post date:** [February 11, 2025, 12:32pm UTC](https://forums.unrealengine.com/t/ai-strafes-when-set-not-to/2327168/8 "2025-02-11T12:32:43Z")

</div>

Not one that I’d definitely know works. I suppose you could set focus and then apply a forward velocity relative to the capsule component on tick until it’s facing the right way then AI move to. But if your rotation is very slow then you’ll still notice it if your player runs around the dog to fast whilst it’s trying to approach.

Also this will be a bit janky if applying that forward velocity would push the dog into a wall or a non-navigable space.

---

<div class="post-metadata">

**Author:** ![BlackHole137](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlackHole137](https://forums.unrealengine.com/u/BlackHole137)\
**Post date:** [February 11, 2025, 12:41pm UTC](https://forums.unrealengine.com/t/ai-strafes-when-set-not-to/2327168/9 "2025-02-11T12:41:34Z")

</div>

Nevermind actually i had accidentally turned off use desired rotation, it doesn’t stop it from turning but determines wether it can strafe relative to the target and not itself

---

<div class="post-metadata">

**Author:** ![BlackHole137](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlackHole137](https://forums.unrealengine.com/u/BlackHole137)\
**Post date:** [February 11, 2025, 12:45pm UTC](https://forums.unrealengine.com/t/ai-strafes-when-set-not-to/2327168/10 "2025-02-11T12:45:37Z")

</div>

I found a workaround for this. I get the xy velcoity of the dog every tick, multiply it’s length by the dog’s forward vector and replace the xy velocity with that.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/9/5/09581bb1675c60e0f947dddc4e4e633ef26aceda.png)  
Seems to work so far

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [March 13, 2025, 12:45pm UTC](https://forums.unrealengine.com/t/ai-strafes-when-set-not-to/2327168/11 "2025-03-13T12:45:49Z")

</div>

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