- Home /
Adjust the direction of a texture in a dynamic drawing
From the code level, I draw the roof of the building based on the points. The roof slopes are in different directions.
I have one type of tile texture.
When an object is added, the texture is in one direction all over the object (global).
I would like the tile to go downhill on each slope of the roof, corresponding to the direction of the roof.
How do I rotate the texture in this situation?
It's not very clear to me, what do you mean by drawing and code level. Is that building a mesh? What software are you using?
I build the entire object, i.e. the mesh (points, triangles), from the code level. In the code, I also assign material I added a picture of what it looks like now. On one slope the texture is good and not on the left one. It should go down the same way as on the one on the right
Answer by Pangamini · Oct 04, 2021 at 11:57 AM
So, if you are generating the mesh from code, then you are probably assigning each vertex an UV. That's a position of that vertex on the texture. To flip a texture, just reverse those coordinates. Reversing both vertically and horizontally will rotate it 180 degrees.