Have an error when I want to use array of vertexDataArray[i].applyToMesh(customMeshArr[i])

Ok please recreate a playground with just this 4 vertices to see what is going on :slight_smile:

this is with the first 4 vertices: https://www.babylonjs-playground.com/#VKBJN#932

and with Normals: https://www.babylonjs-playground.com/#VKBJN#932

ok here is a fix:
https://www.babylonjs-playground.com/#VKBJN#940

You must have 6 indices for 4 vertices because 2 faces of 3 triangles

I did not understand why should I write 0,1,2,0,2,3 . is it any documentation to read about it?

then if I have 100 vertices I must have 102 indices?

is it possible to eliminate the 4th vertices and just work with three vertices, because the 4th one is always the duplicate of the first one.

Hi @Deltakosh

if x and y was latitude and longitude and z in terms of meter , How can use them? should convert x and y to meter?

because indices are representing your faces.
If you have 2 faces, you have 2 x 3 vertices hence 6 values in the index buffer (0, 1, 2 are the indices of the first face’s vertices and 0,2,3 are the indices of the second face’s vertices)

so if you only have 3 vertices then your index buffer will only be (0, 1, 2)

1 Like

Thank you so much.

I found the problem, the coordinates in the geoJSON is in terms of Latitude and Longitude and Altitude.

1 Like

That makes sense!

Is there any google api to use it with babylonJS to convert Latitude and Longitude to x and y?

not that I know of, the conversion will need to be part of your code.

1 Like

Thank you so much