Set spline point rotation in UE4 blueprints

**Skip to the bottom if you just want the c++ code to use**

**Originally written for 4.9. Updated 2016-09-05 for 4.13 (also maybe .10, .11 and .12) code changes**

After following the great tutorials on using splines and spline meshes by DokipenTechTutorials I had a very useable spline_path object, but wanted to extend it a little further. I re-implemented some existing blueprints I was using elsewhere and created options that let me auto-height and auto-pitch start, middle and end points to follow the shape of the ground or object underneath the spline.

However when it came time to set the roll of the spline points, I found there was no blueprint node for it! Existing posts on answerhub and the forums had suggestions of setting the roll on the child splinemesh objects, but I'd already configured that to follow the roll of the spline itself which I wanted to keep:

And I found that the roll of the splinepoints could successfully be set in the editor, so there was code somewhere that was allowing it:

I looked through SplineComponent.h and SplineComponent.cpp which showed that rotation data was stored in SplineRotInfo as quaternions:

And looked through SplineComponentVisualizer.cpp for any references to rotation, where I found this section:

Pulling together all the declarations, and letting previously defined code do all the heavy lifting I was able to put together a blueprint callable function in a C++ blueprint function library as follows:

Create a new c++ blueprint function library and implement the following code. For this your project will need to be code-enabled. Use "File > Add Code To Project" if you haven't done this already.

Once you've added the blueprint function library, implement the following code (pastebin links below images):

.h file:

Pastebin Link

.cpp file:

2016-09-05 UPDATE: SplineRotInfo has been deprecated. Use GetSplinePointsRotation() instead. The text has been updated.

Pastebin Link

Note: make sure you update the copied code to match your project and blueprint function library - lines like 'class TROPICALMANIPULATION_API' and 'void Uspline_extensions' need to be changed.

Compile (ctrl + shift + B), and if you've done everything right you should now be able to add a node to set the rotation:

Usage is similar to other spline nodes: specify the spline and point to edit, and the rotation to set. Rotation is local.


Twitter for updates and cool things.



Hey, do you like videogames? If so check out my new game Grab Throw below. Imagine dodgeball crossed with soccer, except instead of balls you throw stacks of your own teammates.

throwing 2.gif
Golden Syrup Games