(2022-07-23, 19:20)Roland Melkert Wrote: The attached script levels (3 items of) the selection.
The script takes 3 items from the selection and use them to get a plane normal.
Then it uses one of the 2 triangle vectors as the x-axis to build an orientation matrix.
You'll have to rotate it around Y afterwards to get it on its final place.
The really cool thing would be to analyze the mesh (possible in 1.7 Alpha 2a) to get those 3 points automatically.
Nifty! So that makes the process:
- Set the part to be rotated at the origin, and place helper parts at its 3 low points—in this case determined by LDPE. (Hiding the ground tile for the moment…)
- Select the 3 helper parts and apply the script.
- Set the grid relative to the lowest helper part and copy its orientation. Set the main part's rotation center to the relative origin, then rotate it using the matrix option.
- Finally, translate everything upward so the helper parts are at y=0, then delete them. Voila! It's level.