Updating Spline at runtime

Hello everyone,

I started playing with Unreal Engine 4, a couple of days ago.

So far I followed aspline tutorial and here is what bothers me. I spend around 5 hours trying to figure out how to move the last point of the spline using a sine function.

I know it sound silly and easy, but I have no previous experience with anything related to UE4.

So far I tried to get the number of splines point in my spline and use it as the index to get the up vector, to then multiple by a sine function. I’m just trying to make the end of the spline move up and down using the sine function, to later do the same with N points of the spline to see how a rectangular mesh deform like a sheet of paper or aluminum.

My spline actor blueprint is created in a construct script just like the link above, but I’m referencing the spline in the Event Graph. Instead of using Begin Play I’m using Event Tick, thinking that the what I’m trying to achieved at least run every frame, but when I hit play nothing happens.

Can someone point me in the right direction or know of any tutorial that address a solution to this problem? or at least someone know how to manipulate a spline in real-time rather than using the Editor?

Edited 2020-06-18:

Here is what I want to achieve at runtime probably using a timer multiply by sine(2Pi) to make it oscillate. Is this possible to do with the spline at real time, I don’t see any Set Spline Tangent Rotation At Point or any blue print that allows me to do this changes.

spline_rotate_tangent.gif

My end goal is to do something similar to the following image below. Is this achievable or I’m trying to solve the problem with spline instead of some other UE4 feature that works better for my goals?

rtaImage.gif

1 Like

Ok, I got it working. My problem was that I took for granted that the spline and spline mesh update automatically. After saving the mesh component into an array and then updating the values calling again the spline object, the spline and the mesh component of the spline started oscillating.

2 Likes

Hi! Sorry for necroposting, but I’m struggling with the same problem at the moment, could you please share some details about the solution?
I’m trying to update spline mesh at runtime too, but I ended up with updating only last element in the spline for some reason

I ran to the same issue and this forum gave me food for thought or more understanding of how splines work. That combined with this useful video tutorial:

Basically what you need to do:

  1. In the Construction Script: as your run the FOR LOOP to populate add spline meshes, create an Array and save every spline mesh added to make an array to store the added spline meshes. Adding the Spline mesh in the array (at each index) should be the very last step after setting the mesh and axis…etc
  2. In the Event graph: as you update the spline end position, run another for loop (basically similar to the consturction script) and that’s where the array will come in handy, as you only need to Set Start & Ens position of each spline mesh (using the index multiplied by the mesh length).
    Hopre this makes sense
2 Likes