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

Hello everyone

I want to build the following model:

and I have Geojson file as an input data which consists of coordinates.

I have make an arrays of vertex data, indices and positions.
when I wanted to set vertexDataArray[i].applyToMesh(customMeshArr[i]) in the for loop, I have got 250 error, Is it possible to help me know how should I set vertexDataArray[i].applyToMesh(customMeshArr[i])

this is my PG for a tiny section of my Geojson:

https://www.babylonjs-playground.com/#VKBJN#923

You should have a look at this doc: Create Custom Meshes - Babylon.js Documentation as it details the procedure for this.

I am not seeing the errors in the log

these are the errors in my console.

I have read the documentation but there is not any example same as my problem

I see no error as well

Hi , I have solve it , The problem was indices and I should divided them by 3, and now I face to another problem.

I didn’t have any triangle : https://www.babylonjs-playground.com/#VKBJN#923

and I don’t understand what is my mistake.

I see triangles but I guess this is not what you expect:
image

What do you expect?

1 Like

how did you get that angle?
i think if I got that angle I can got the model
because I can not see even this triangle.

and the positions array in the PG is just a tiny part of original Geojson

how can I rotate my model to get this ?

i just rotated the camera :slight_smile:

I rotate it But always I got the just line

well I rotate it a bit :slight_smile:

Thanks a lot for your screen recording :pray:t2: :pray:t2:

again with the Original Geojson I couldn’t get the model, what is wrong in my code?

this is the model that I should build with Geojson, is it other way to build it?

Are you sure your data contains triangle lists? maybe they are triangle fans

what is Triangle fans?

The question you have to answer if that: is each face made of 3 vertex OR are they packed in a triangle fan fashion:

This is the part of the Geojson that I should build The model , but I don’t know is it triangle fan or triangle mesh, how can I found?

[
{
“type”: “Feature”,
“geometry”: {
“type”: “GeometryCollection”,
“geometries”: [
{
“type”: “Polygon”,
“coordinates”: [
[
[-4.67365, 58.43086, 5247.6],
[-4.68345, 58.43669, 3850.5],
[-4.66852, 58.42488, 2523.2],
[-4.67365, 58.43086, 5247.6]
]
]
},
{
“type”: “Polygon”,
“coordinates”: [
[
[-4.67365, 58.43086, 5247.6],
[-4.66889, 58.42739, 5176.2],
[-4.66852, 58.42488, 2523.2],
[-4.67365, 58.43086, 5247.6]
]
]
},

“properties”: {
“name”: “FZRU-MYCFB”,
“description”: “<tr bgcolor=”#E3E3F3">\n\n\n<tr bgcolor="">\n\n\n<tr bgcolor="#E3E3F3">\n\n\n<tr bgcolor="">\n\n\n<tr bgcolor="#E3E3F3">\n\n\n<tr bgcolor="">\n\n\n<tr bgcolor="#E3E3F3">\n\n\n

Attributes
SECTION UK_Reg02_Section_394
LEX_RCS FZRU-MYCFB
LEX_D FAULT ZONE ROCKS, UNASSIGNED - MYLONITIC-ROCK AND FAULT-BRECCIA
RCS_D MYLONITIC-ROCK AND FAULT-BRECCIA
HYDRO_D Predominantly fracture-low productivity
AQUIFER_D NULL
PERIOD NULL
",
“stroke”: “#93b000”,
“stroke-opacity”: 0,
“stroke-width”: 1,
“fill”: “#93b000”,
“fill-opacity”: 0.8,
“SECTION”: “UK_Reg02_Section_394”,
“LEX_RCS”: “FZRU-MYCFB”,
“LEX_D”: “FAULT ZONE ROCKS, UNASSIGNED - MYLONITIC-ROCK AND FAULT-BRECCIA”,
“RCS_D”: “MYLONITIC-ROCK AND FAULT-BRECCIA”,
“HYDRO_D”: “Predominantly fracture-low productivity”,
“AQUIFER_D”: “NULL”,
“PERIOD”: “NULL”
},
“id”: “kml_1”
},

In the geojson its like each face made of 3 vertex, and the 4th vertex is the duplicate of first vertex

I have searched on the forum and I found :
matArr[i].fillMode = BABYLON.Material.TriangleFillMode;

I use this but again nothing happened

https://www.babylonjs-playground.com/#VKBJN#926

Ok let’s do it step by step. Can we start with a geoJSON containing only one or two triangles?
Because there is also thet problem about you creating a mesh per triangle which seems wrong to me

You’re too kind. I cannot express my appreciation.

there is one triangle, it means there is 4 vertices in each brackets but the 4th vertex is the same as the first vertex, and also there are 24 cluster which each cluster has some coordinates and specific id to build triangles and also each cluster has specific color and some other properties, because of that I made 24 custom mesh. is it any mistake in my code?

I upload the geojson file:
test.zip (38.7 KB)

I think there are something wrong in the geoJSON file, because the numbers in the Z axis are so big number in terms of X and Y. (e.g. [-4.67365, 58.43086, 5247.6]).

I said to my supervisor to revision the GeoJSON file, but she didn’t inform me until now yet.