Call for a LERP node, Please

Could one of the great coders in the comunity please set up a LERP node please. Ideally it would take a starting and ending translation (location, rotation, scale) and time for the change. It would be a very very useful addition.

I found a “lerp function” in the examples.

The more complex one is followCamera

…and the more easy solution is: script_camera_lerp

I think gamesfromscratch made a tutorial about creating custom nodes or a example is in the manual

gamesfromscratch: Tutorial

If someone who can simply make it is needing some inspiration :wink:

Pull Request is up, that node is gonna be useful for me as well I think :grinning:

Until Lubos accepts it you can try putting them in yourself, there are only two files added and you can see their contents in the Pull Request.

1 Like

Well, i tried it. And: Oh man … i really thank you! I just built successfully my first ever custom node. I can´t believe it is THAT easy to set up and making some custom nodes. I am speechlees. Now the window opens and i see a lot of possibilities!

Ps.: I also added a switch camera node and put them all together into the logic_node_pack (since i wanted to have a clean Armory installent). You can get a pretty awesome node collection by doing this.

@Simonrazer - Thanks for the quick response, I am not sure it’s doing what I need. Maybe I am using it wrong. What I was hoping for was to but it vector 1 and vector 2 and the object to move between them over “Time” amount of seconds. With your example of using a set vector from the out seems to move the item instantly. Am I missing something or did I not explain it correctly in the original post? What would I change to make it work in this manor if possible.

Sorry, your explanation was fine I just read it too quick. Will try to make something like that today for logic_pack

As for this node, there was already the Vector Mix node, which has more functionality but is a bit trickier to use. Now it has been updated so it is more intuitive, it works basically the same as the Lerp node you just need to multiply “Delta Time” by like 15 before you plug it into the Factor.

1 Like

No problem - I looked at that node and could make no sense of it. I am not sure how a vector output does what I am thinking. I don’t really think the node would end up with any output but out. I must be not understanding LERP in the same terms as others. In unity when I did use it long ago it was the function that allow you to move between two points in a certain amount of time. By the looks of answers here and in discord is seem that it is just the vector line.

Anyway if you have a better explanation of how to use the Vector Mix or can write one that just moves between points slowly that would be awesome. If it helps I am trying to use it instead of simple animations as I still can’t get them to work right either.

Thank you again. I will be sure to credit you in the videos and training I doing with this in it.

Ok I think I got it now.
You activate the node on a single frame. The interpolation will run for as much seconds as you set, and in the end the Vector that is being put out is the same as the “End Vector”.
For the Vector to arrive at its destination at the right time the “Starting-” and “End Vector” need to stay the same throughout the whole time the node is supposed to run. I tried to achieve this in-node, but I couldn’t get it to work. So if the Vector is changing, you need to lock it it place when the node is started, like it is done with the three bottom-most nodes in this setup. In this case the vector changes because it is the location of “Cylinder”, which is being altered with the “Set Location” node in the end.

If you want abort the interpolation and reuse the node (Press “Space” again in this case) you need to set “Stop Interpolation” for (at least) one frame to true. This resets the timer and the output-Vector.

The node is now available in logic_pack.


Absolutely Perfect !!! Thank you so much. I should note that if anyone else updates the logic pack to use this you may have to replace other nodes in the pack as they must have been updated over the last little while. Other then that little hiccup (which had nothing to do with the Lerp Vectors function) it works great. I really didn’t test the stop interpolation socket in that I was using hard coded vectors in my case.

Thank you again - you will be credited big time in my next Mistwire Tutorial.

@Simonrazer - two quick questions while I have your attention :slight_smile:
When you use the set parent node, shouldn’t the child then inherit the transforms of the parent? It doesn’t seem to do so.

and with the Lerp node - can you think of a way to capture the starting location of the Lerp from an object therefore not needing the object to stay stationary. I will probably play with that for a couple of uses. one way might be to spawn a empty in that location and use that as the original location (or ending too I suppose). Another would be to capture the values into variables and use them to drive the vectors. I am not sure if either of those could be (or should be ) incorporated into the Node.

Thank you again for the great work. I have shown it and used in my latest Tutorial that should be out in a few days. I will post a video of it working on this thread soon.

Here is the game play video

1 Like

I tried to make the vectors sty static in the nodes code, but I couldn’t get it to work. It seems like when the part that is dealing with returning the vector is active the inputs are always being updated, no matter where I put these inputs in the code. So the simplest solution is I think to set the objects’ locations to a vector before the node is activated in the node tree and drive the Lerp Node of these Vectors, like I showed in the image above.

Sounds good to me. Again many thanks for the effort. It was well worth it.