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?
Yeah
If you print out the rotation rate whilst the dog is following you is there perhaps a chance it’s being set to 0?
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
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.
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?
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.
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