I’m trying to create an animation of a garage door, so it will be a couple of meshes following a spline.
I’m having trouble understanding how to set up my spline.
The mesh correctly follows the spline and rotates 90° around Z in this scenario.
My idea now was to rotate that spline, because this is how I want to move and rotate the mesh (90° on X):
you seem to be almost there. The way I do it is that I set “Current Point” and “Next Point”. Current Point and Next Point stores point into them by callcing “Get Location At Spline Point” i and i+1. Then lerp it from 0 to 1 and update then update “Current Point = Next Point” and “Next Point = Get Location At Spline Point + 1” and move again. I hope that makes some sense. But if it doesn’t I can elaborate more.
So think of it as having spline with multiple points. You have access to what the location is at a specific point on spline. So using that we can do setup like this:
Index will keep track of which point you are on. You will start with 1 in this case. That is because we will store point 0 as current and target as point 1 (index). After that we do the lerp. Lerp has to be between 2 non changing points for the duration. You can change speed by changing timeline. mine is from 0 - 1. Below image is an example:
After the lerp (timeline is done) you have reached to target point. You add 1 to index, check if you have reached the end. If yes, the you exit. If no, you make make current location = target location, get next spline point using the incremented index and save it in target location and run the timeline from start again:
NOTE: you have to take care for 1 thing. I.E. if you want the location to be in world space or local space. You can change that when you use the function “Get Location at Spline Point”
No, they are separate blueprints.
Switching Get Location to World fixed the movement, it’s now moving along the spline.
Do you have any idea how to make the rotation work?
If you click on point, press E and rotate it, that will change its tangent. Instead after selecting point, go to properties and enter desired rotation. I have marked it in above picture
Spline can be annoying. Generally mistakes happen where you won’t expect them. I have had a massive work done in splines one time, which taught this to me quite a bit but it was frustrating to start out with. You’ll get there. Till then you will have to try over many times