Download

Spline road tool Tutorial blueprints

hello,

I don’t know if this is the right place to put tutorials in but it seemed like the perfect place to post one.
I figured out how to make a universal spline tool, so you have to make one blueprint and you can use it to make numbers of different splines with. Like a road or a fence. as long as it should be next to each other.
I thought it would be useful to share it with everybody.

So Lets get started.

Create a new blueprint of the type Actor by right clicking in the content browser and clicking Blueprint. A menu will pop up and you need to click Actor.

SplineTUT0.png

SplineTUT1.png

Open the blueprint you just made and click add Component, and search for Spline. Click that

SplineTUT2.png

SplineTUT3.png

Create the 2 float variables above and do not forget to make them public, compile then and put 50 in the Spacing and 2 in the tangent scale variable

Open the construction script and drag off a pin from the Construction Script node, Search for ForLoop. Place one. When you placed that drag off a reference to the spline actor by Ctrl + Drag the spline tool in the components tab. From that node you drag and search for a get spline length node.
From that Spline Length node’s return value you drag a division (whole and remainder). In the Divisor you need to put a reference to the Spacing variable in. That return value you put into the last index (integer) on the ForLoop.

SplineTUT4.png

Drag the Index of the ForLoop into a Integer x Float node (Int * Float).

c4f1e9e2cf89221be677ed656f0aae838a77a73e.png

From that node you create the folowing in the exact same order as the image below. (The SplineComponentRoad is the Spline component’s name)

SplineTUT5.png

Keep the rest of the return wires empty for now.

From the loop body in the ForLoop node, drag a wire and search Add Spline Mesh Component. From that node you drag a wire and search Set Static Mesh. The return value of “Add Spline Mesh Component” needs to be connected to the Target port of “Set Start and End” (On the image it looks like it comes from a different node but the return of the “Set Static Mesh” node is a Boolean. There is a reroute node of the "Add Spline Mesh Component on top of it). From The Set Static Mesh node drag a wire and add a set start and end node. On this node you add the yellow transform wires from the top to the bottom in the same order as you placed them at step 5. The target port in this Set Start and End node needs to be connected to Add Spline Mesh Component node.

SplineTUT7.png

Now go to the Set Static Mesh node and drag a wire from the New Mesh port. Select Promote to variable (Not local value) and type in a name for the variable. Make sure it is connected to the node and the variable is public. Don’t add a mesh to this variable yet.

fa1d3e549f0c2ee41f9b4cba755c1b3f602e3496.png

  1. Once that all is done, compile and save the blueprint and go to your level. Drag the blueprint in the scene and select it. In the details panel you see the Spacing (should be 50), Tangent scale (Should be 2) and mesh (Should be empty).
    Once in the details panel you can select a mesh for this spline tool and if you want a different mesh on a different spline just drag in a new one. you can change the spacing as well and the tangent to get the result you like.

I really hope this helped someone.

If you need help with something just send a PM or reply to this threat.

(I saw a huge mistake in an image and put a note in red in the text, follow those instructions to not become confused)