Using Lerp Inside a For Each Loop

Hi all,

I have a piece of blueprint code that I’m using to rotate an object array around a cube in +/-90 degree increments. A For Each Loop takes my object array and transforms each object into x and y values and then plugs the x and y values into a trig formula to give me 90 degree rotation. I’m currently plugging that value into a set world location block at the end of the for each loop.

This all works well for moving my object array but I’m wondering if its possible to use a lerp or vinterp block to have a smooth transition to my new vector. I’ve tried storing the start vector into a variable at the beginning of the for each loop and then use the sum of the trig formula as the second point in a Lerp or Vinterp Node but this gives poor results. I’m not sure how to use a lerp or vinterp inside this for each loop or if its even possible.

Here is an example of my current blueprint for +90 degree rotation.

Thank you for any advice on the subject! This project is my first attempt at programming, so my apologizes if its a dumb question.

Matt

Why not do the rotation inside of your actor and only trigger it with this script?

For lerp to actually look smooth you need to call that each tick until it’s in the desired location. You can do that inside of those actors themselfs easily and just trigger the event via some interface… or just a custom event or something.

I ended up doing like Erasio said, at the time I was having trouble communicating between blueprints and was referencing alot of things through an array. I know just have code inside each piece and attach each of them to the other object using the attach to actor function.