currently I am using 2 triangles or 4 wedges with EgoMoose’s triangle drawing code. This is inefficient for what it does and I think can be improved to 2 wedges and one part. How could i go about doing that?
Not all quads can be made using only 2 wedges, think for example rhombuses. Rhombuses cannot be made using only two right-angle triangles (which is what wedges are), so it must be decomposed into four individual wedges.
I’d say you could probably get away with two wedges one part/square
If you assume the quads are all squares, you can use vector cross product to find the angle to put the wedges in.
We have a quad defined by the points ABCD in order, like this:
A - - - - B
| / |
| / |
| / |
D - - - - C
Wedge1 is at point A and Wedge2 is at point C. Both wedge should face the cross product of points D and B, relative to which point the wedge belongs to. It would look something like this:
local cross1: Vector3 = (D-A):Cross(B-A)
Wedge1.CFrame = CFrame.lookAlong(midpoint, cross1)
local cross2: Vector3 = (D-C):Cross(B-C)
Wedge2.CFrame = CFrame.lookAlong(midpoint, cross2)
I have another post where i solved a similar problem but for triangles instead of quads. You can check it out here: Need help with CFrame calculation - #2 by NOVEIGMA
my issue is needing to draw quadrilaterals that are more trapezoidal
i’ve already determined they can be split like this
A - - - - B
/| |\
/ | | \
/ | | \
D - - - - - - - - C
my only issue is that I’m not good at trigonometry so have no idea what math to do to get to that point