Smooth dynamic spline tangents

So I am creating dynamic splines based off of AI waypoints and their navmesh path, which aside from adding the splinemesh (which can destroy performance once I have a complex path at the moment), I am having issues with getting the tangents to setup nicely.

As you can see in this picture the spline with no tangent set is doing a wrap around to get to the next point. I have tried a few different methods using the previous and next spline points to try and figure out a nice tangent but can not seem to get a straight smooth tangent figured out.


Giving this 1 a bump since I still have not managed a solution that makes it better, only 1 that makes it worse hah.

Just set tangents manually to 0,0,0 and you will get nice corners. If you want them to be smooth then you need to use at least two control points per each corner, some distance before and after corner.

I assumed it was already setting them to 0,0,0 by default. Setting it to local and to 0,0,0 gave me the right angle corners correctly so that solved 1 problem at least!

I still haven’t managed to get rounded corners intentionally though. I haven’t been able to find a way of adding 2 control points and offsetting them in the direction they should be to give the correct curve. All I can do as modify a single tangent for each spline point, there does not seem to be a way to add 2?

On another note, while the right angles should be what I need to calculate my projectile targeting, since it should be the exact path the AI is taking on the navmesh. It seems that in some circumstances it creates a rounded curve along the spline on it’s own, any ideas on why this might happen?


By default control points are set to “smooth” and you can change it using blueprints - SetPointType or something like that. When you move points their tangents will be re-calculated automatically so if you don’t set their type to fixed their tangents might change.
For smooth corners I would use original spline as source and build a second one as smooth. You start with empty spline and then sample one control point at a time. Check GetDirectionAtDistance some distance before and after each control point. Do a dot product of directions and if result is large enough add two points into new spline instead of one.
There is a node AddPoint or something like that, I don’t know if you can insert new points between existing ones, this is a why I would build a new spline instead.