Scalable door model with scalable number of boards

anyone can help with this ?
like JohnyK say

@Wingnut @JohnK @Arte

Hi R. Did you try what JohnK suggested? Use ExtrudePolygon instead of ExtrudeShape?

Here is a test board from a different playground series. https://playground.babylonjs.com/#4G18GY#134 It uses ExtrudePolygon.

Looks ok, huh? As John mentioned, extrudePolygon has a different plotting-orientation than extrudeShape. So, when you re-assemble your door with these new boards, you will need to do some board .rotation (and likely .position) adjustments/changes.

createDoor() function will be ALMOST the same as before… but we made changes at the sawmill that cut the trees into boards. :slight_smile:

Brain strain from grain pain. heh. The issue is related to “caps” as JohnK states (like the top and bottom of beer cans). The verts/indices on the “cap” of the can… often have a wagon-wheel or star pattern, and when you map a wood-grain texture onto that wagon-wheel pattern, it looks terrible (needs special tweaks).

So, what johnK proposes here, it to NOT have the “cap” of the shape… aiming “up”. Put the “caps” on the butt-ends of the boards… and look at the shape from the side, instead-of from the top (the capped end). You can set your material to wireframe mode… to see/understand more about caps/orientations.

https://www.babylonjs-playground.com/#Q8C4KX#17 See the “x” or “star shape” in the wireframed boards? yuh, yuh, yuh. :slight_smile:

Shape-builders… we got a pile of 'em here in Lake Babylon. I don’t know how to drive them very well.

2 Likes

It is much heavier than I thought :smiley:
My brain is bleeding :crazy_face:

If you have already tried extrudepolygon then post your PG (playground) and we’ll have a look. If you haven’t tried yet then try the following changes in the PG #Q8C4KX#16

in shape array elements 0 to 7
swap the y and z values,
make sure the points order is counter clockwise (adding/removing .reverse if polygons do not appear correctly as in lines 63, 127 etc.)
remove pushing the first point ( examples lines 54, 64 etc.)
rotate each polygon by pi/2
change extrudeShape to extrudePolygon with correct parameters

Save and post the PG you get and if any issues they will be easier to help you with.

3 Likes