I have a polygon in 3D space. All the vertices of this polygon are in same plane. (It is a 2D polygon but rotated in 3D space). Obviously, the normal of all these vertices are same. I need to calculate UV coordinates for these vertices.
I could think of an approach.
Approach:
Rotate this these vertices in such a way that it becomes XY plane.
Calculate UV for each vertex.
Rotate back.
Is there any better approach?
If not, I need a code snippet to rotate it to make it XY plane.
Where did the polygon come from? It is possible that the vertices are already in XY plane and rendered using a rotation matrix. You could check out positions of vertices see Update Vertices - Babylon.js Documentation