private static string ExportBrick(Brick b) { Vector3 bhScale = BB.CorrectScale(b.Scale.SwapYZ(), b.Rotation * -1); Vector3 bhPos = b.Position.ToBB(bhScale); // this is the long line that defines bricks string export = $"{bhPos.x.ToString(CultureInfo.InvariantCulture)} {bhPos.y.ToString(CultureInfo.InvariantCulture)} {bhPos.z.ToString(CultureInfo.InvariantCulture)} {bhScale.x.ToString(CultureInfo.InvariantCulture)} {bhScale.y.ToString(CultureInfo.InvariantCulture)} {bhScale.z.ToString(CultureInfo.InvariantCulture)} {b.BrickColor.r.ToString(CultureInfo.InvariantCulture)} {b.BrickColor.g.ToString(CultureInfo.InvariantCulture)} {b.BrickColor.b.ToString(CultureInfo.InvariantCulture)} {b.Transparency.ToString(CultureInfo.InvariantCulture)}"; export += $"\n\t+NAME {b.Name.RemoveNewlines()}"; // brick name if (b.Rotation != 0) { export += $"\n\t+ROT {(b.Rotation * -1).ToString(CultureInfo.InvariantCulture)}"; // rotation } if (b.Shape != Brick.ShapeType.cube) { export += $"\n\t+SHAPE {b.Shape.ToString()}"; // shape } if (!b.CollisionEnabled) { export += $"\n\t+NOCOLLISION"; // collision } if (!string.IsNullOrEmpty(b.Model)) { export += $"\n\t+MODEL {b.Model.RemoveNewlines()}"; // model } if (b.Clickable) // clickable { export += $"\n\t+CLICKABLE"; if (b.ClickDistance > 0f) { export += " " + b.ClickDistance.ToString(CultureInfo.InvariantCulture); } } return(export); }