From 664acb140e63df6edd2ba2ec8ccd576da492527c Mon Sep 17 00:00:00 2001 From: DamianX Date: Thu, 23 Jan 2020 22:53:07 +0100 Subject: [PATCH] Normalize wander AI's direction vector (#549) --- Content.Server/AI/WanderProcessor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Content.Server/AI/WanderProcessor.cs b/Content.Server/AI/WanderProcessor.cs index 1b1117235c..39bdf34478 100644 --- a/Content.Server/AI/WanderProcessor.cs +++ b/Content.Server/AI/WanderProcessor.cs @@ -125,7 +125,7 @@ namespace Content.Server.AI var rngState = GenSeed(); for (var i = 0; i < 3; i++) // you get 3 chances to find a place to walk { - var dir = new Vector2(Random01(ref rngState) * 2 - 1, Random01(ref rngState) *2 -1); + var dir = new Vector2(Random01(ref rngState) * 2 - 1, Random01(ref rngState) *2 -1).Normalized; var ray = new Ray(entWorldPos, dir, (int) CollisionGroup.Impassable); var rayResult = _physMan.IntersectRay(ray, MaxWalkDistance, SelfEntity);