Reputation: 15
I need a shape similar to a polygonal prism standing on one its (non-rectangular) polygon faces but where the top face could be tilted.
Similar to this image, but it need not be a square/rectangle but any polygon (concave/convex).
I considered the following ways of doing it, but they feel sub-optimal:
I also need to be able to have different tilts for both the top and bottom faces later.
Upvotes: 0
Views: 298
Reputation: 36
You could create a wrapper around the bufferGeometry class where you take in the top and bottom vertices of the polygon. Triangulate the sides of the polygon and create your custom Float32Array. Use this for the position attribute of bufferGeometry, I guess you could use the same array for UVs as well (I'm not sure).
You could refer these for triangulation
Upvotes: 2