This Houdini HDA takes modular pieces like pipes and fits them along a user generated spline. Using Houdini Engine for Unreal you can feed it any number of static mesh pieces and create procedural layouts directly in engine. This method has advantages over 100% procedural geometry system as it can work with any set of hand crafted modular pieces created by an artist.

**Features**

- Input modular segments of any size; HDA optimally fits or scales each segment.
- Adjust scale of pieces.
- Appropriately fits pieces within each curve segment.
- Aligns elbow pieces to correct angles.
- Adds 3-way and 4-way connectors at curve intersections.
- Rotates repeating segments at 45-degree intervals to vary texture.
- Insert valves at user-defined intervals.
- Place mounts at specified intervals, aligning with reference geometry.
- Option for curve to snap to reference geometry and generate vertical segments.
- Generate offset curves from the original for modular pieces to follow.
- Batches pieces to minimize draw calls.

## Inputs

**Modular Pieces****Repeating Segments****Corners**- Set piece angle
- Define flange circumference and width

**Intersections**- Supports 3-way and 4-way

**Secondary Pieces**(e.g., valves)**Mounts**(for attachment to other objects)

**Curves**

## Snapping to Length

## Calculating Corner Pieces

In order to place the correct corner pieces I measure the angle, adjust normals and calculate the amount to bevel the curve to fit the corner mesh.

- Calculate the angle of each corner point (90, 45, 18.75, ect). This tell it what piece to use.
- Orient the corner piece by setting the N to point at the previous point and the up direction at the next point.
- Calculate the bevel amount to subtract from the curve to fit the corner piece. To do this I use some trigonometry in Vex.