Spike Trap Spikes going down faster each time the trap is Triggered

Also, how do you set World location? It might cause troubles as well.

Another hint: since all the spikes move the same, you can reference only one in the blueprint, and attach all the others to this one as children.

i agree a lerp would be the easiest way to go and you can have the value still as a variable if you wanted. i personally would go with a lerp vector and a set relative location setup to make things simple. or you could always just use the timeline to do all the work, meaning if you want the spike to move x units over y time then set the value of the timeline to 0-x and the duration to y.

So I made this spike trap blueprint:

pardon the cluster that it is. It works fine except for one small detail, everytime the player triggers it the second pic of the blueprint moves the spikes back down faster and faster or slower depending on how you look at it. Anyway the result is that the spikes end up receding further and further into the ground. The first timeline runs in.10 secs to get the spikes up then after a 1 sec delay the second timeline takes them back down over 4 secs.

Now I know that a solution to fix my issue would be to just give them a hard start and end point vector but I don’t really want to do that given the way it is currently set up. The first float variable is set to 20 which gets them up where I want them in the given time. The second float is set to 1.05 to get it back down over 4 seconds to where I want it. It works perfectly the first time but then as I keep triggering it it somehow keeps taking longer for the spikes to return to the bottom. And while having the float numbers off a bit could explain the difference in how far down they go it won’t explain why it works exactly the way I want it to the first time but not the times after, but more importantly it doesn’t explain why the time for it to go down seems to be increasing slowly from 4 seconds to 5 and if I keep going it just gets longer.

Any ideas on what’s causing this? I’m sure it is something small I’m overlooking. Below are 2 shots of my timelines just for reference.

Timelines are best used as alpha values for lerping between two values.

If you lerp between an Initial Position, and an Active Position, using the timeline output as the alpha value, you can use the same timeline for transitioning upward and downward (set the play rate accordingly, if you want one to take longer than the other). For example, default duration 1 second, set play rate to 10 for attack or 0.25 for retract (0.1 seconds and 4 seconds respectively).

If you wish to use one timeline, you would do so by calling reverse from end to retract, and play from start to attack.

This will ensure your location values are always within this range, and keeps your blueprint a lot tidier.

Edit: I will also add that you can plug in all of your spike components into the same “AddWorldOffset” node :wink:

I personally prefer using Target Points, and Ease nodes to ease between them. It’s much more visual for you in the viewport, you know exactly the start and end points of your movement.


As for the timeline, like Sir Unfathomable said, it’s 0 to 1, since you use it as Alpha for the Ease node, and if you set the time for the curve points to 0 and 1 as well, it will be very easy to set the time for your movement by simply setting the timeline play rate, like 0.2 for 5 seconds, etc.

There’s little to add besides what the gents downstairs mentioned - Lerping between 2 offsets does it. Let me just suggest you add the spikes to an array and loop. You can do what you do with 1 node rather than 24.

I tried the array but it only activated the first spike in the array not sure why though.

You have to use a ForEach loop for the array and frankly you don’t need it here. All your spikes do the exact same thing. So go to your viewport, select all of the spikes that belong to one trap except one (the first one for convenience), and just drag all of them to the one that’s not selected in the World Outliner list. They will be attached to the first one, and then all you have to do is work with only one first spike in your blueprint, all the rest will duplicate its movement.

I tried the array but it only
activated the first spike in the array
not sure why though.

I’d do it like this:

Image from Gyazo

I like that, that’s clever.