public void AddRectangle(Vector3 pos, Vector2 dimensions, float rot) { Vector3 vert = new Vector3(0, 0, pos.Z); // bottom left corner vert.X = -dimensions.X / 2.0f; vert.Y = -dimensions.Y / 2.0f; vert = new Vector3(JabMath.RotateVector(new Vector2(vert.X, vert.Y), rot).X, JabMath.RotateVector(new Vector2(vert.X, vert.Y), rot).Y, pos.Z); vert += pos; AddVertex(vert); // bottom right corner vert.X = dimensions.X / 2.0f; vert.Y = -dimensions.Y / 2.0f; vert = new Vector3(JabMath.RotateVector(new Vector2(vert.X, vert.Y), rot).X, JabMath.RotateVector(new Vector2(vert.X, vert.Y), rot).Y, pos.Z); vert += pos; AddVertex(vert); // top left corner vert.X = -dimensions.X / 2.0f; vert.Y = dimensions.Y / 2.0f; vert = new Vector3(JabMath.RotateVector(new Vector2(vert.X, vert.Y), rot).X, JabMath.RotateVector(new Vector2(vert.X, vert.Y), rot).Y, pos.Z); vert += pos; AddVertex(vert); rot += 1.0f * (float)Math.PI; // bottom left corner vert.X = -dimensions.X / 2.0f; vert.Y = -dimensions.Y / 2.0f; vert = new Vector3(JabMath.RotateVector(new Vector2(vert.X, vert.Y), rot).X, JabMath.RotateVector(new Vector2(vert.X, vert.Y), rot).Y, pos.Z); vert += pos; AddVertex(vert); // bottom right corner vert.X = dimensions.X / 2.0f; vert.Y = -dimensions.Y / 2.0f; vert = new Vector3(JabMath.RotateVector(new Vector2(vert.X, vert.Y), rot).X, JabMath.RotateVector(new Vector2(vert.X, vert.Y), rot).Y, pos.Z); vert += pos; AddVertex(vert); // top left corner vert.X = -dimensions.X / 2.0f; vert.Y = dimensions.Y / 2.0f; vert = new Vector3(JabMath.RotateVector(new Vector2(vert.X, vert.Y), rot).X, JabMath.RotateVector(new Vector2(vert.X, vert.Y), rot).Y, pos.Z); vert += pos; AddVertex(vert); }