How to loop through vertices of a sphere

vars.sphere = MeshBuilder.CreateSphere("sphere", { diameter: 4, segments: 10 }, vars.scene);

// I was expecting, but vertices dont exist
for (let i = 0; i < vars.sphere.vertices.length; i++) {
        let vert = vars.sphere.vertices[i];

// Then tried
log(vars.sphere.getVerticesData()); // results in null

Any ideas?



getVerticesData requires a kind parameter

Got it…

// 1 find out what data is in the thing

// 2. get the data (documentation states strings from constants such as 
// VertexBuffer.PositionKind, these all return NULL, use string found from no1 above
// Note doesnt return arrays of x,y,z but a single array so you will need to parse it in 3s.