public static MeshBuilder Stretch(this MeshBuilder mb, aabb3 oldSize, aabb3 newSize) { var scale = newSize.size / oldSize.size; for (int i = 0; i < mb.vertices.Count; i++) { var v = mb.vertices[i]; mb.vertices[i] = newSize.a + (v - oldSize.a) * scale; } return(mb); }
public static MeshBuilder Stretch(this MeshBuilder mb, aabb3 newSize) => mb.Stretch(new aabb3(vec3.one / 2.0f), newSize);