How would I be able to stretch the uvs of the tube of the cylinder after it’s creation, using it’s verticesData?
Not sure of a way to only get the uvs of the tube of the cylinder in order to do this basically:
How would I be able to stretch the uvs of the tube of the cylinder after it’s creation, using it’s verticesData?
Not sure of a way to only get the uvs of the tube of the cylinder in order to do this basically:
don’t forget to set mesh as updatable, and then do something like this :
also, don’t hesitate to read the documentation : Updating Vertices | Babylon.js Documentation
That’s not what I wanted to achieve exactly. I am familiar with a way to stretch all uvs of a mesh, but I’m only looking to stretch the uvs of the tube part of the cylinder, and not the top and bottom part, as seen marked on the image I posted.
Since the cylinder has 300+ uv values, I’m not sure where to start…
You could try checking if the corresponding normals are lying within a vertical or horizontal plan.
Dot(normal, up) = 0 -> tube else cap
So I get the normals of the mesh and then see which are lying within a vertical/horizontal plane.
But how do I actually get the UV data from that info afterwards?
You get the normals same way you get the UV. UV size array should be N * 2 floats and Normal array size should be N * 3. Where N is the number of vertices. So, it’s easy to get the corresponding normal for a particular UV index.