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

iTween’s operations are mostly meant to move from a designated starting point to a designated ending point. When you call a tween, you’re more or less locking those start and end values in. However you can change these values as the tween happens. I can’t promise it’ll look perfect, but you can try! are a few options to have a moving tween end target:

  1. If you drag out from the Return Value on a tween, you can get the properties of it, like its end target. Drag out and search for “VectorTo.” Every Tick, you can set vectorTo to be the current location of the head socket (if you’re coming from the pelvis socket, you can reverse them if you’re going the other way). This way the tween will automatically try to compensate its current position to better reflect the updated position. This may look the worst, but it’s an option. It also might look fine.
  2. You can have a spline component as a child of your character’s blueprint and have point A be the pelvis and point B b the head. Then you can use ActorMoveToSplinePoint nodes to transition. The splint points will always follow your character this way. If your head or pelvis move slightly because of animations, you can set the spline point locations to be the current locations of the sockets on Tick so they will follow more precisely. The tween will always follow the exact path of the spline, so you can be sure it will never look weird. There is some inherent overhead with setting the spline point locations every frame, so maybe using a Timer would be a better idea to update them every half-second or so.
  3. You can use ActorMoveUpdate. The -Update functions are meant to be used with moving targets. Unlike the other nodes, these must be called on Tick or a Timer. You can have a branch before the node that checks a boolean and the boolean can be something like “moveToSocket.” If you want to tween the object, set “moveToSocket” to true so the -Update node will be called and immediately after check to see if the object’s current location is nearly equal to the VectorTo plugged into the -Update function, and if so set “moveToSocket” to false. This is probably your worst option because it requires quite a bit of Ticking or very fast Timers and does not come with many of the options the other two come with, like EaseTypes.

Yes, you just have to design some differentiation. This is easy to do by giving your tween operations a unique name (“Tween Name”). Then from “Event On Tween Update” you can you can call a Switch on Name and plug “Tween Name” into “Selection.” This way whenever OnTweenUpdate is called you’ll be able to specify code paths for each name. Different tweens can execute different code based on their names.

Hey paragon, I’m sorry you’re experiencing difficulty! Without seeing your folder structure and everything it’s hard to say what exactly is going on, but let me ask a few clarifying questions:

  1. Is your project a code project? That is to say, did you start the project as a C+±ready project? If not, have you ever used the “File->Add Code To Project” option from within the engine?
  2. I don’t mean to insult your intelligence by asking this, but in the interest of having all the information, did you recompile your game binary using visual studio?

I hope to get this sorted with you :slight_smile:

Hello Infinite Zenith, let me see if I can help!

Because splines are built into UE4, iTween for UE4 doesn’t need necessarily to cover all of the pathing stuff that the Unity version needed to. PutOnPath() for instance can be achieved by calling SetActorLocation() passing in GetWorldLocationAtTime from the spline component. If your spline has a “Duration” of 1.0 (and all do by default) then you can just pass in a 0.0-1.0 percent range.

What you can do for your situation, if I understand it correctly (and please let me know if I don’t! :)) is call ActorMoveToSplinePoint() using spline A and use the EventOnTweenComplete interface message to call ActorMoveToSplinePoint() using spline B when the first tween ends. Does that make sense? I can expand more if you need it.