I would like to put a texture only on top of an extruded polygon, and use a different one for the sides. My code looks pretty much like this:

https://playground.babylonjs.com/#YUZ658

As you can see, I tried to do special cases for triangles and quadrilaterals, but I couldn’t figure it out for pentagons. I would like to support at least octagons (regular or irregular), more if possible. Is there a simple formula that works for all shapes? I couldn’t find any code related to vertices in the polygonBuilder.ts:

Is there an easier solution than going into the VertexData and comparing the height of the vertices? Are they even guaranteed to be contiguous? When I tried to access the vertex positions like this: `const positions = polygon.getVerticesData(VertexBuffer.PositionKind).positions;`

, I got `undefined`

. Is that the right approach here?

By the way, I can’t use face colors, I need a proper material.

Thanks in advance for your help! I’m sure it’s just a case of not knowing what to look for.