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

First time using iTween. Our project works beautifully on a PC but refuses to open up on a Mac. We have the iTween plugin folder packaged in our project / plugins folder.

Any lead/insight would be so incredibly appreciated!

Best wishes,

The old projectā€™s in need of a migration, so weā€™ll probably just do a rebuild in 4.11. Itā€™s not particularly large, so weā€™ll probably be able to pull it off. We looked for the old iTInterface elements and found a few references, but something else was happening, too. A little bit of elbow-grease is what weā€™ll need.

I have another query now. Is it possible to update the destination vector while a tween is already. Thanks for all of your help :slight_smile:

Yes, absolutely. you can pull out of the iTween callā€™s return value and search for SetVectorTo. You can change this however you want at runtime. Just be aware that if the vector changes too much at once, youā€™ll end up with your actor popping from one location to the next to compensate the distance. Youā€™re better off changing that value over time. It will change the speed of travel however to compensate for the location difference.

Hey ,
can we have a recompile for 4.12 please?
Thanks! :slight_smile:

EDIT: Oh, nevermind :slight_smile: Just found out that youā€™ve made a video tutorial on how to rebuild the plugin for a newer UE version. Worked like a charm! Thanks!

Delegate System

One question about the new delegate system:
Letā€™s say, I start a Tween of type Float From/To named Fade Out and specify a function named Fade Out Function as the target for OnTweenUpdateTarget. Now I create this function and call the node Set Scalar Parameter Value inside of it, which changes the alpha of my material. Now before v0.8.7, I used the node Event On Tween Update to access the float value (from Data Type Values), Tween Name, Alpha Completion and so on. With the delegate system, what should I do to access these values inside the Fade Out Function knowing the name of the Tween?

's the recompile!

Youā€™d do something like this:

In this case youā€™d set the target as Self and Create a delegate function name then create an actual function with the same name. Now you can pull out of the return value from the tween and get ā€œdtvā€ which stands for Data Type values (typing ā€œdata typeā€ should also have it show up too because of the meta data). Similar to using the interface method, you can just break the struct and get the float value from there. This is faster than using interfaces and a heck of a whole lot more convenient! You donā€™t even need to name your Tweens with this method, though Iā€™d still recommend doing so.

Ahh, dtv! Havenā€™t seen this one. Thank you !
Now I started to convert my animations to delegates and they work good so far (and look more organized). In my case I will need several reusable delegate functions, so I can use them in different Tweens. Thatā€™s why Iā€™m forced to save the Tweens as variables and use them in delegate functions. But why do I have to create more variables if I already named all my Tweens? Can I just search for a Tween with a specific name and pull out of it inside my delegate functions? I know there are nodes for stopping/pausing/resuming Tweens, which accept Tween names, but I couldnā€™t find anything that just returns a Tween.

Iā€™ll add this node in a future release :slight_smile: Iā€™d recommend against using it on Update/Tick though, honestly. It will likely be a bit slow. Youā€™re better off either creating variables or just putting the function next to the tween like I did in the screenshot. You can of course have the function call another function with minimal impact on performance if you need to for organizationā€™s sake.

Hey , I have two problems moving along a spline:

  1. Iā€™m using Actor Move To Spline Point (Full) on a spline with two points. I noticed that my actor is moving with an easeout slowing down at the second point, although I set it to linear.

  2. The tick types: If I choose Seconds the speed of the actor depends on the length of the spline (in 1 second it slides slower along a 2m than along a 4m long spline), which is ok in some cases. But shouldnā€™t choosing Speed negate this dependency? I wanted to make my actor move at a constant speed, no matter how long the spline will be, but itā€™s changing the speed when I modify the spline.

Hey SONB,

  1. Let me verify with you, youā€™re saying you have a spline with only two points: 0 and 1. The actor slows down as it approaches 1, correct? Is the spline straight?

  2. Speed is only meant to provide a tweaking alternative to time, not to provide a constant speed. I will try to offer an alternative tick type that offers constant speed in a future release, but I canā€™t make any promises. One thing you can do to mitigate this is to change the tick type value on the fly. Pull out of the return value on your tween and set the tick type value directly to compensate.

I have error with packaging ā€¦ Can you help me ? Thanks !

Sorry for the late reply, .

  1. Yes, this is correct and the spline is straight.

  2. The speed is not a game breaker, Iā€™m gonna follow your advice and change the value on the fly. But crossing my fingers for an alternative tick type :slight_smile:

Thanks!

UPDATE: Now I created a spline with 3 points. My actor slows down and makes a full stop at point 1, then accelerates and stops at point 2 without slowing down.

UPDATE 2: I should have told you that my actor is a Character. That might be the issue. I loaded my experimental level, where Iā€™m using the Custom Gravity Plugin (I planned to make my Character run around a planet). This plugin requires a custom Character class, so I converted my default Character actor to the pluginā€™s custom Character actor. I donā€™t know which changes the author of this plugin made to his Character class, but after I made a bent spline with 3 points and let my Character run along it, there was no easeout, as expected.

Iā€™m going to make more tests in my planetary level and try to fix some minor problems while tweening. My spline is laying on the ground of the planet and as soon as my Character begins to tween along the spline, it sinks feet deep into the ground. When the tween completes, he jumps back onto the ground. Somehow I have to tell the tween (on update) not to use the hight of the spline.

Hi !

Is it possible to change the End Value of a Float From/To tween on the fly, while this tween is already running?

is what Iā€™m trying to do:

Distance Of Selected Step changes later and the End Value of the tween must be updated with it, when I call the function again.

When I test it and try to update the value on the fly while it is already running, it just jumps to the new value, without interpolating to it.
If itā€™s possible, what did I miss?

Or can I just start the tween again, like I did the first time? Because it works fine this way. If I do start the tween again and again while itā€™s running, is it internally reused or duplicated?

Hi ,

First up, thanks again for the library!

Have just updated from 0.8.6 to 0.8.7 and have run into a few issues.

There were a few errors that I presume are Xcode-specific that prevented iTween from compiling:

  1. I had to resolve a compiler warning/error in the elasticInOut ease where it was complaining about mutating the value variable with -= within a big expression (unsequenced modification and access to ā€˜valueā€™, might be C++11 specific). I just moved the -= out of the main return statement and it was fine.
  2. I also had to add a missing implementation for OnTweenUpdate in iTInterface.cpp

Those changes allowed me to compile, but sadly the game now crashes whenever a tween is started (have seen errors using both FloatFromToSimple and LinearColorFromToSimple)
Not sure if you can think of anything off the top of your head, but the stack trace is usually something like:

SEGV_MAPERR at 0x170

UiTween::SpawnEvent(AiTAux*) Address = 0x170a151a8 [Runtime/Engine/Classes/GameFramework/Actor.h, line 705] [in UE4Editor-iTween.dylib]
UiTween::FloatFromToSimple(FName, float, float, float, EEaseType::EaseType, FString, UObject*, UObject*, UObject*, UObject*) Address = 0x170a94f71 [/Users/Geordie/Documents/XXX/Plugins/iTween/Source/iTween/Private/iTween.cpp, line 3288] [in UE4Editor-iTween.dylib]
UiTween::execFloatFromToSimple(FFrame&, void*) Address = 0x170b369d3 ā€¦/ā€¦/ā€¦/ā€¦/ā€¦/Geordie/Documents/XXX/Plugins/iTween/Source/iTween/Private/iTween.h, line 29] [in UE4Editor-iTween.dylib]
UFunction::Invoke(UObject*, FFrame&, void*) Address = 0x10def18f2 [/Users/build/Build/++UE4+Release-4.12+Compile/Sync/Engine/Source/Runtime/CoreUObject/Private/UObject/Class.cpp, line 5078] [in UE4Editor-CoreUObject.dylib]
UObject::CallFunction(FFrame&, void*, UFunction*) Address = 0x10e0d2f71 [Runtime/Core/Public/Stats/Stats2.h, line 1537] [in UE4Editor-CoreUObject.dylib]
UObject::ProcessContextOpcode(FFrame&, void*, bool) Address = 0x10e0e2a09 [/Users/build/Build/++UE4+Release-4.12+Compile/Sync/Engine/Source/Runtime/CoreUObject/Private/UObject/ScriptCore.cpp, line 2060] [in UE4Editor-CoreUObject.dylib]
ā€¦]

Really wanna upgrade but not quite sure where to start with debugging this. Any help would be greatly appreciated!

Cheers,
Geordie

Okay thankfully I was able to fix - seemed to have been due to there not being a pawn for the player controller when spawning the event actor.

Changed UiTween.SpawnEvent() so that if GetWorldLocal()->GetFirstPlayerController()->GetPawn() is null then it reverts to the old behaviour of just spawning at world origin.

Hi ,

iTween seems really awesome but even though youā€™re giving it away for free we canā€™t use it in commercial products unless you are able to give a license.txt with it. Even a Creative Commons license would be fine: Creative Commons ā€” ShareAlike 1.0 Generic ā€” CC SA 1.0

Thanks!

Hey everyone, sorry for being late. Extremely late. My girlfriend and I have wanted to take a euro trip for a while and we decided to finally do it. Iā€™ve been gone much of the summer! But now Iā€™m back, to tween with yā€™all.

Sure , whatā€™s the problem? Can you provide a stack trace, error logs or output? Preferably everything? :smiley:

You can pull out of the return value of any tween event and set ValueTo directly that way, but it will change the interpolation so that the tween interpolates between the original start value and new end value. If the new end value is too ā€œdistantā€ from the original end value it will appear to jump.

What youā€™re doing is probably ok as long as you donā€™t see any adverse effects. The tweens automatically destroy themselves when their timers complete, so starting a new one is fine, especially in the case of value tweens since theyā€™ll happen after the first tween every tick and just overwrite the firstā€™s values. There are definitely ā€œsaferā€ alternatives however:

-You can start an interim tween with the start value being the original tweenā€™s original end value and the end value of the interim tween being the new end value you want. Then set the end value of the original tween to be this new interpolated value from the interim tween. Make it run for as many seconds as are left in the original tween. You can get this amount with this pseudo-equation: OriginalNumberOfSeconds * (1.0 - Alpha (ā€œAlphaā€ is a property on the original tween)). This will give you the number of seconds you have left in the original tween. This is probably the smoothest and safest solution, though a bit convoluted/messy.
-You can call StopTweenByName on the current tween then start it over with the new start value being the current value and the new end value being whatever you want it to be. Since youā€™re doing linear easing there should be nothing weird or jarring. This is basically what youā€™re already doing with an extra step to ensure no overlap.

Iā€™m going to have some time today to look into the spline easing issue as well. Iā€™m gonna figure out this dilemma.

Thatā€™s a bug on my end! I guess it didnā€™t occur to me that there would be situations where youā€™d use iTween and not have a possessed pawn. Totally my fault.

I switched from World Origin to accommodate large world games for the sake of memory management and preempting the possibility of a tween getting ā€œculledā€ and not working. Iā€™ll use another object for this attachment. Thank you for finding this bug!

Regarding the earlier points with compiling on xcode, I put in some platform checks for the very latest versions of iTween that should compile without issue. Are you using the very latest version? If so then I have more work to do.

Hi , Iā€™d never considered this either. I think I started working on working out exactly what i was going to do vis a vis (free) licensing but to be frank itā€™s not as interesting as programming the thing :stuck_out_tongue: Iā€™ll take a look at your link later and try to figure something out. The stop-gap is that the easing equations are taken directly from another source with its own license in turn, so i have to figure out exactly what they require in their license before working out my own. All of the rest of the code however is original, so thatā€™s the only thing I really need to consider. I will get back to you!

Awesome thanks a lot! Looking forward to integrating it into our project.

Taking a second look at it tonight, I wasnā€™t able to reproduce this issue. Not with a regular static mesh, not with a character. It may indeed be something to do with the modified character class in your project. Can you try this issue again in a brand new project with a regular static mesh then with a regular character then once more with the modified character class you want to use after adding it? I donā€™t think this is an iTween issue, but I may be able to work around it if we can narrow down the problem.