Hello , I am trying to use Itween to move a train engine/cars combo along a spline to follow as if they were connected. I read the following directions you gave below some time back on the subject, but I am having a bit of a hard time following (due to my lack of experience). Would it be possible to elaborate a bit further on these directions to help me along? Right off the bat I am a bit confused about how to implement iTInterface. Thank you so much in advance and thank you for making this amazing plugin!!
"For right now, you can do all that stuff by using the OnTweenUpdate interface event. OnTweenUpdate is called after all other tweening operations, so you can add transformations in this event and you shouldn’t have any issues.
-Implement iTInterface in a blueprint.
-When you call iTween, make sure you give your tween a unique name and set the blueprint that implements the interface as the “OnTweenUpdateTarget.”
-Go to that target blueprint and add an event called “OnTweenUpdate.”
-From , drag out of the tween name input and do a switch on name. Set one of the outputs to be your tween’s name. This is why I encourage unique names so that whatever you call only reacts to that specific tween.
-Now you can apply extra transformations. In the case of incorrect orientation, you can get the actor’s rotation and invert it then set the rotation to be the inverted one you just calculated. In the case of the trains, you can run 3 tweens all off of one spline then OnTweenUpdate you can set its position to be its current position + the transform direction’d additional position."
Hey Alexaendergfx! Thanks for writing. You can certainly use iTinterface, but it’s the old way of doing things. I added a much easier way of doing things using delegates last year, I’d really recommend using that system instead. I outlined a scenario in a post on the last page, I’ll quote it below so you can take a quick look. Basically, you set the object that has a certain function on it then specify the function name and the plugin will call that function on that object. You can get tween information from the return value from the iTween call, as shown in the screenshot.
Anything you can do with iTinterface can be done with this method and is faster and more convenient That said, you may have to think around your original design, it all depends on what you’re trying to do. What’s your program flow?
Sure, all of this is possible using delegates! The tutorials are a little outdated, yeah. I do apologize for that. One day I will get around to making more updated ones, but the design of the plugin is guaranteed to change so it may not be soon
the data tween updates a float, vector, color, whatever every frame and then stores them in a struct called “dtv” - you can also get it by typing “Data Values.”
First call the tween and pull out of the return value pin - type “dtv” or “data values” and you’ll get the data values struct from it. Get the float value from that struct.
In my example, I’m using a float tween to make a number in a UMG widget decrease steadily over time until it hits 0. This is a real world example from a game I’m currently working on.
On the Tween, you can specify the OnUpdateFunctionName and set the OnTweenUpdateTarget to be “self.” In this screen I’m using the Simple node, but you can do it with Full too. If you use simple, you’ll have to use the parser to set the function name - “oufn = UpdateNumberText” or whatever you want the function name to be. You don’t need the “oufn =” part if you’re using the Full node.
Side note: “oufn” stands for “On Update Function Name.” You can also type “OnUpdateFunctionName =” or “OnTweenUpdateFunctionName =.” Whatever you feel most comfortable with. The other delegates abbreviate similarly (OnCompleteFunctionName shortens to “ocfn,” for example).
Then create a custom event or function named the same, in my case “UpdateNumberText.” This function will be called every single time the tween updates and in this case, we want to update the number every single frame. 's what the setup looks like:
You can set any property on any object in this way. Does that information help?
Edit: I found the solution - I had two tweens set up to run on the same object (opening and closing a menu) and hadn’t implemented a check to see whether one had finished before trying to run the other. (Knew it would be a dumb mistake!) That left me with two tweens trying to access the same AitAux object at once which crashed the program.
Ok, this is probably a newbie mistake somewhere, but I’m getting constant crashes trying to use the latest iTween on Unreal 4.15 to tween a vector2D to change a UMG widget slot size. I’m working entirely in Blueprint for this widget but the project is mixed BP and code.
The issue is that I can set up the Blueprint, have everything working nicely, and then when I close and re-open the BP I get an Access Violation crash pointing at iTween.cpp line 88:
aux = (AiTAux*)(GetWorldLocal()->SpawnActor<AiTAux>(AiTAux::StaticClass(), params));
I recreated the BP and it looks like this:
Can anyone point out where I’m going wrong?
Hey EmzDickson, I’m really glad you found the solution to this crash, but by all means this shouldn’t happen. If iTAux exists, it should just use the one that exists. If it doesn’t, it should create it. This is a big problem! I wasn’t able to repro it on my machine however, any chance you can show me the stack trace? I want all the logs you have if you can manage it