rdInst Tutorial 32 – Populating Splines

rdInst 1.35 has some new nodes and c++ for populating splines with SplineMeshComponents. This can speed up editing splines, and has code to re-use the SMCs during runtime for fast spline populating during play.

In this tutorial we populate a wall along a spline with SplineMeshComponents – when playing the spline is moved up and down at one point in the spline and the wall is redrawn – showing the speed benefits of using rdInst to populate.

Step 1. Create a new Blueprint Subclassed on rdActor

Create a new Blueprint, in this tutorial I’ve named it “BP_PopulateSpline”. Open it in the Blueprint Editor and add a Spline Component.

Then add the variables in the snapshot below. The “data” variable is an array of “rdSplinePopulateData” structures.

Compile the blueprint, and then set the defaults. for the “mesh”, set it to the WallSegment static mesh (or whatever you wish).

For the “data” array, add 2 items and set the meshes in each item – here we’re using the 2 WallSegments.

Step 2. Add a new Function called “BuildSpline”

Add a new function, call it “BuildSpline” and add the following code:

Specifying 0 as the end distance means draw until the end of the spline.

Step 3. Add code to animate the spline in the Tick Event

Step 4. Draw out the spline and test by playing the level

Step 5. Change the DrawSpline routine to use the data based population

Step 6. Test by playing the level