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

Hi there,

Thanks a lot for this plugin, I’ve been using it heavely (from/to/tick) for the past weeks and I must say it works like a charm !

I’m a bit stuck now though : I would need my actors to move following a more complex path, I thus want to use Splines, but I don’t seem to get how to use Splines as a track for moving actors. Do you happen to have some guideline regarding this ? I’m not talking about Landscape splines since I’ve read that it doesn’t work (due to its way of being handle in BP yet which is none).

Thanks a lot for your help and keep up the hard work !

F

Hey Fitzrurisk, welcome to the discussion!

I’d be glad to offer some assistance, but I need a bit more information. Do you want to tween an actor along a path from start to finish, or do you want to move an actor to an arbitrary point on a path?

Thanks a lot !

I’m working on a underwater world, and thus wanted to have fishes and… underwater things to move in a natural way. That’s why splines seem to be the right thing to use ! I thus wanted physically place one spline per actor (i.e. fish) in the world and trigger the iTween movements when I see fit. On trigger, the actors would move alone the spline for start to finish and then stop (I would hide them at that point).

Thanks for your precious help and for the work on that plugin !

F

Easy!

In this example, the itween trigger is on the fish, but it can be from anywhere. When the fish is told to move along the spline, it should fire an “Actor Move To Spline Point” node. I recommend Simple because Full, while giving you all of the options without having to use the scripting language, is quite long. Simple has the most-used options.

Give the tween a name (so you can uniquely identify it), set the actor to move to be the fish (which in this case is self), and get a spline from the scene. Any blueprint with a spline component will work, just get the spline component from it and plug that in. If you don’t have a spline in your scene already, you can search “spline” in the modes panel and use iTSpline, which is nothing more than an actor with a spline component.

“Move to path,” when enabled, will move your actor from its current position to the beginning of the spline then follow through the rest of the spline. Be aware that this will change the spline tangents. If disabled, your actor will snap to the location of the first spline point then follow it through.

Sweep will stop the tween if the object that’s moving collides with something else. It’s best to leave this off for this situation.

Set the number of seconds the animation should take and choose an Easetype. I recommend Ease In And Out Quadratic, because its motion looks the most organic and natural, in my opinion.

Next, if you want your fish to look in the direction it’s traveling, enter “orientation = path” into the Parameters field. The semicolon at the end is optional. The semicolon is used to separate different Parameters, but since you only have one it isn’t necessary. “Orientation” is an option on the Full node, but we can save space in your blueprint by using the Parameters parser. You can find more information on parser language and logic on the wiki.

Lastly, set a target blueprint to accept OnTweenComplete events (in this case, self) and if you’d like, you can have iTween destroy the spline actor it used as a path when it’s finished. This is useful if you’re building a linear level and the player won’t come back to this area; destroying the spline actor would remove a little bit of overhead from your scene. Do not use this option if your spline component is part of an important actor you don’t want to destroy as this option destroys the containing actor, not just the component.

Now make sure your blueprint implements the iTInterface by going to class settings and adding it. Compile then bring up the blueprint context menu and find “Event On Tween Complete.” This will fire when the tween is finished as long as you have something plugged into OnTweenCompleteTarget. Because you only have one tween , running a switch on name is optional. It is a best practice however when you have multiple tweens sending messages to the same blueprint. When the tween completes, call “destroy actor” on the fish.

I hope that helps!

First, thanks a lot your help !

I must have missed something somewhere : I’m quite familiar with the iTween’s way of working (naming, timing, targeting etc), the only thing I can’t make work is the spline part. 's what I’ve done :
I’ve created an empty blueprint (named SPLINE2) and added a Spline Component (named “Jaredspline”). I’ve then placed the BP into the persistent world, and extented the spline (alt key).

I’ve then put the SPLINE2 into my Level Blueprint, placed a “get Jaredspline” from it and plugged it to my Spline entry in the itween.

When I trigger the ActorMoveToSpline, I don’t get any error message, but the mesh doesn’t move as if it were - for example - set as a “static mesh” and not “movable”.

Whoops, oversight on my part. What’s happening is your tween is being created and destroyed immediately because “tie to object validity” is on and I need to comb over the code again to ensure this doesn’t happen. In the meantime, you can turn this option off by adding this to your parameters:

tietoobjectvalidity = false;

Thanks for catching this bug for us!

That’s it ! It works perfectly now, thanks a lot !

Out of curiosity : how is that it was working with the iTween from/to but not with the spline?

Thanks again !

In the iTweenEvent, there’s a “first set” phase where it makes sure that the object begins at the point specified by the user. First it checks the event type (Move from to, move to spline, scale from to, etc.) then checks to see first if the object you’re acting upon exists. If TieToObjectValidity is enabled, it will terminate the tween if the object you’re acting upon is gone. This is intended. If your object is destroyed, you probably don’t want your tween still operating.

Later on, I added an “enforceValueTo” option that forces the object to the value specified as the end value. This is the opposite of “first set.” I added this because when using floats, you can sometimes end up with slight imprecisions. Enforcing the end value ensures that the value will be exact. I copied over most of the code from “first set” and changed as necessary. It looks like I accidentally cut the spline block instead of copying it, so while it had representation in “last set,” it no longer had representation in “first set.” I just never noticed because I wasn’t using spline operations in my projects (and neither apparently were others, understandable because I don’t have a tutorial up).

So now when going through “first set,” it’s checking all of the event types EXCEPT the spline events, so when it sees there’s an event type it doesn’t recognise, it panics and throws execution to the tieToObjectValidity check. It’s on by default, so it’s saying “Okay, it’s not an event type we recognise, so we’ll just destroy the tween before it does any damage.” Turning that check off keeps the tween going.

Tonight I’ll rectify that and put out a hotfix.

we are, 0.8.6b HOTFIX: Mediafire

-Fixes an issue that was destroying spline operation tweens the moment they were created when tieToObjectValidity was enabled(which it is by default). Thanks to Fitzrurisk for helping us find the bug!

I just transferred my windows project on mac and after building Xcode, m getting this error in tween.cpp “iTween.cpp:715:19: Expected a class or namespace, Reference to eventType is ambiguous, Expected a class or namespace”.

Is there some setting I have to do to build it for mac?

Thanks,

Eh, sometimes Mac/iOS compilers don’t like how I code. I apologize for this since I don’t have a Mac to really build with and neither does anyone else on my team :stuck_out_tongue:

But it looks like it’s unhappy with how I don’t declare EEventType before dereferencing EventType even though I declare the namespace in the header. It’s just the compiler being nitpicky.

Are you using the installed iTween source or did you install as a plugin? If you are using the source, you can just change EventType::actorMoveFromTo to EEventType::EventType::actorMoveFromTo and rebuild. If not, I will run through all of my enum references and be more specific then release hotfix 2 sometime tomorrow.

I lied, I did it tonight.

's v0.8.6b hotfix 2: Mediafire

This provides extra specification to otheriwse ambiguous enum references. If you’re experiencing “ambiguous” packaging issues on Mac/iOS, try this hotfix.

Well that was fast ! Thanks for being that reactive, it’s pretty impressive :slight_smile:

I’ll definitely keep using itween, and if I find some buggy things I’ll post that , don’t worry

Please do! It would be very much appreciated. Thanks for helping us battle the bug menace :slight_smile:

Hi again !

Well, now that everything’s working propery, I decided to build my project… Well, it wouldn’t because of iTween and the first error was the C2143 “;” missing.

Checking back in the iTween sources in iTweenModule.h, well indeed :

screenshotJaredbis.

So you might want to check that (I used v0.8.5b, maybe it’s sorted now) !

But still, I just get another error now, a more tricky one :

And I must say I’m a bit stuck now :confused:

Does it ring a bell or something? That’d be great !

Thanks a lot (again !)

F

The latter is sorted in newer versions; the former keeps popping back up. I don’t know if it’s a quirk in my versioning system or Visual Assist thinking it knows better than me, but that semicolon does not like to stay there, heh.

If you don’t want to download the new version, you can simply comment out the line that calls “SetActorLabel()” at that line. 2965. This was something that set the name of the tween event operator based on its event type and index in currentTweens. Unfortunately, this does not package and only works in the editor, so it was removed in recent versions. It can innocuously be removed. :slight_smile:

Thanks for the quick update and it did fix that issue but now m having a different issue where it fails to build mac lib. is the error
"Undefined symbols for architecture x86_64:
“STweenableWidget::OnTweenUpdate(AiTweenEvent*, AActor*, USceneComponent*, UWidget*, FName, FDataTypeValues, float)”, referenced from:
vtable for STweenableWidget in iTInterface.cpp.o
ERROR: UBT ERROR: Failed to produce item: /Users/hntb/Documents/Unreal Projects/Unreal_HNTB_Projects/UITest/Plugins/iTween/Binaries/Mac/UE4Editor-iTween.dylib
"
will building from the source will fix that as right now its a plugin version?

Thanks,

Possibly, packaging with the plugin version of iTween is not working out too well with most projects. However, unless your project is small I don’t think switching over to the install version of iTween would be in your best interest since the namespaces are inherently different and you’d have to re-do all of the iTween stuff. It’s not an insurmountable task, but it isn’t trivial. It’s a whole afternoon of work or more.

I’m not 100% sure what this error is referring to. Normally, undefined symbol means that you’ve declared a function in your header but haven’t provided implementation in the source. There is definitely implementation in the source, however.

If you aren’t using slate tweens (and if you aren’t using C++, you definitely aren’t), try removing the STweenableWidget class from iTInterface.h and all of the functions that derive from STweenableWidget in iTInterface.cpp (all of the ones that begin with STweenableWidget::slight_smile: then try to rebuild and repackage. If it builds or the error message changes then it could help narrow down the problem.

Cool that fixed it. I remove all the STweenableWidget class references from iTInterface.h, iTInterface.cpp, iTweenEvent.h and iTweenEvent.cpp and rebuild it.

Thanks for the help.

Hi there !

I am (again) ! Everything works perfectly now, I can build the whole project, so thanks very much indeed !

I have a small issue with one of my fishes : It’s been created using Maya and the bones are OK but it’s not facing correctly : when using Orientation = Path in Itween, it does work, but the fish moves toward its side, like it’s surfing (or is drunk, which is pretty cool but definitely not correct !). I usually correct that with reimporting the mesh and skelleton and use the “rotation option” when importing. But on that particular fish, the skelleton root seems to be offset with the mesh root and rotating at import completely messes the animation (the fish now looks like it’s been run over by a car, which is quite less cool than previously, but still quite fun).

My question is : is it possible to rotate that actor by 90° and then to use the MoveActorToSplinePoint with Orientation = Path to make sure the fish faces the spline (with its nose, not its bum)? I’ve seen the “constrain rotation” node in the iTween lib, can that help me? Do you have something in mind?

Thanks a lot again :smiley:

Take care,

F