My First Roof
This tutorial explains how to set up components for procedurally generating a roof. To avoid duplicating steps from the previous tutorial My First Wall, this tutorial omits details about geometry setup.
For the completed tutorial, refer to the scene My First Roof in Samples.
Geometry Setup
First, set up the geometry by constructing roof-like lines.
Next, add planes.
Important
Ensure that plane gizmos are rendering correctly so you can verify the planes are facing the right direction. To invert a plane's direction, select the Cozy Plane
and use the Invert button in the Cozy Toolbar
.
Tiles
Now we move to the exciting part—generating tiles from the planes.
- Create a new GameObject with the
Cozy Grid
component and make it a child of yourPlane
GameObject. - Add the following components:
Cozy Grid
Cozy Double Lap Tiling
Cozy Draw
- For the
Cozy Draw
component:- Enable Global Rotation.
- Set Cell Size to
0.2, 0.16, 0.2
.
Once set up, duplicate this tile GameObject for all four planes.
Corners
Tile intersections at corners often do not look clean. To fix this, you can create specialized tiling for corners.
- Select the
Cozy Spline
for the corner. - Create a new GameObject with the
Cozy Segments
component and make it a child of theSpline
GameObject. - Add the
Cozy Draw
component to the new GameObject. - Select the prefab from
Models/Roof/Tile Corner
and set Cell Size to0.2, 0.77, 0.7
.