/// <summary> /// Cuts vector near wall /// </summary> /// <param name="from">vector2 position</param> /// <returns></returns> public static Vector3 CutVectorNearWall(Vector2 from) { var distance = Player.Instance.Position.Distance(from); var x = from.Shorten(Player.Instance.Position.To2D(), distance); var output = new Vector2(); for (var i = 0; i < 1000; i++) { var vec = Player.Instance.Position.Extend(x, i); if (!vec.IsWall()) continue; output = vec; break; } return output.ToVector3(); }