Wrestled with this one last night, but couldn’t figure it out. Found a few posts on here about it, but I still wasn’t able to crack it.
I want to animate a sliding door. The door mesh exists within the blueprint. Below is the best I could get working.
Now, this works; but I want to reuse the blueprint. Which means going in and changing location for each copy of it.
I know there must be a way to move a blueprint relative to its current position. But I can’t figure out how to set that up. (I assume I would use a vector graph and just translate along x, and add it to the current position).
You could use a AddRelativeLocation node, but you would have to change how you use the timeline as it would be adding the amount every frame.
Otherwise you could so something like this. By storing the original location, and getting the target location by adding how much you want to translate. This way the only variable you have to change is how much you want it to move.
However, I’m not sure if that is a good way to do it as I don’t know if timelines will be affected by framerate. There is ways around that problem too though.
Here the length of the timeline will control how far it translates, as well as the vector value. This is added on tick.
Set the end point vector to: GetCurrentLocation + (getRightVector * distanceDoorShouldTravelToBeFullyOpened).
This way, whenever you clone your sliding door blueprint, you only need to change the distance door needs to travel to be fully open variable. And only if you ever need to make it travel further to open.
Note: distance door needs to travel is a float. And getRightVector assumes the door slides rightwards. If its left, just use a negative value for the multiplier, if its upwards use getUpVector.*
Not sure if the ‘GetWorldLocation’ is the correct node (seemed to make the most sense). Also, I’m confused by the multiply - shouldn’t I be adding the forward vector amount to the current location? I want to move 70 cm, if I multiply by that amount, the door is flying clear away. Right? Maybe I don’t understand how vector multiplications work (and by “maybe”, I mean “probably”). Anyway, 0.7 gave me the closest result. I’d prefer to put in the actual amount in cm though.
Also, the timeline isn’t flipflopping correctly. In my setup it works, but done this way the door just keeps moving in the same direction each time you click it - no back and forth.
Okay, I’ve updated my graph with just world space. I tested my outputs with print string, and they are working with this vector math (traveling 70 cm in Y).
However, when I plug in the setworld location, my door is sailing away. It’s moving way more than 70 cm. I’m assuming the timeline is repeating the move on each tick - or something likethat - instead of just executing it once. Any ideas?