[Open Beta] Procedural On-the-Fly Animation in UE4: iTween!

Yo Ity, welcome to iTween!

you have two options. Either way you’ll have to add the iTInterface to your car blueprint (Class Options > Interfaces > Add > iTInterface). This will not work in a Level Blueprint because they do not use interfaces.

Option 1:

Set up a MoveActorToSplinePoint tween on your car’s blueprint and plug in your spline. Name it something like “TweenCar.” Make sure “self” is plugged into “ActorToTween” and “OnTweenUpdateTarget.” With iTInterface implemented, find “EventOnTweenUpdate” and from that run a switch using the TweenName output and check for “TweenCar” or whatever you named it. If that’s the name of the Tween being evaluated on that frame, you can check to see its AlphaCompletion. This is a normalized value between 0 and 1 which shows how far along into the animation you currently are, 0 being “just started” and 1 being “finished.” Since you’re turning into an intersection and stopping, I’d guess the alpha completion you’re looking for is 0.5, but you can try different values to see what works. When you’ve reached that AlphaCompletion value, use PauseTweeningByTweenName then set a timer that calls ResumeTweeningByTweenName after your delay. Make sure you write the Tween Name in each of these nodes. The name is case-sensitive.

This will allow you to keep using your current setup, but may look a bit too robotic since the tween will not slow to a stop to pause. It will just stop. It won’t slow to resume either. If you want to ease in and out of these, you’ll have to have multiple tween which is option 2.

Option 2:

Set up two splines instead of 1. Spline1 begins at the bottom and ends in the middle of the intersection, Spline2 starts where Spline1 ended and ends itself to the left. Set up a MoveActorToSplinePoint tween on your car’s blueprint and plug in Spline1. Name it something like “TweenCarPart1.” Make sure “self” is plugged into “ActorToTween” and “OnTweenCompleteTarget.” With iTInterface implemented, find “EventOnTweenComplete” and from that run a switch using the TweenName output and check for “TweenCarPart1” or whatever you named it. If that’s the name of the Tween that just finished, you can then set a timer that waits for your delay and sets off another MoveActorToSplinePoint using Spline2. In this one, you’ll notice “MoveToPath” is turned on. This option makes your actor move to the beginning of the next spline to prevent it from popping into place if Spline2’s first vertex isn’t in the exact same spot as Spline1’s last vertex.

This means you’ll have to modify your scene some, but the work is minimal and you’ll be able to ease in and out of your “pause.”

Let me know how this works out for you. Good luck!