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."
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));
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?
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
Thank you so much âŠI am creating a railroad train system for my project. I am hoping to move numerous cars behind the engine using iTween and be able to create switches to change to different splines for branches of the railroad. I will definitely try out your new system! Thanks again for responding!!!
There is no example demo just yet. I have been working on a feature demo in my spare time, but it takes a backseat to fleshing out the actual plugin, which in turn takes a backseat to projects that pay the rent
Because when I wrote it I knew little about splines - itâs on the todo list for a revamp using time/duration/distance. In the meantime you can pull off the return value of the tween, get its alpha ( a normalized number between 0 and 1 that tells you how far along the tween is) and multiply it by the splineâs duration then get rotation along spline at time using that value and set it onTweenUpdate to get an accurate rotation. This does not account for any kind of smoothing however, but you can use RotateUpdate for that if you want to.
Those of you having trouble packaging the game, please try this build instead. Iâm not actually 100% sure which files need to be included with a plugin in order for everything to work, so I stripped out a number of them I thought wouldnât be necessary for file size reasons. This build includes everything and as a result is somewhat large, but I tested it this morning and was able to successfully package for Win32, Win64, Android and HTML5. Failing that, you may need to recompile it yourself or add it to your gameâs source.
Hey Hermyth, when you create a tween you get an iTweenEvent return value - pull out of this and set the TickTypeValue variable on it directly. You may also want to try explicitly stopping the tween then creating a new tween from its current position/rotation/scale to a new position/rotation/scale where you want it to actually end up stopping. So KeyPress > StopTweeningByName > Start new Tween on same object from current position to stopping position.
Hey, , thought Iâd mention that there are some code base warnings when building the plugin for 4.16:
\Plugins\iTween v0.8.7\iTween\Source\iTween\iTween.Build.cs(7,12) : warning CS0618: âUnrealBuildTool.ModuleRules.ModuleRules()â is obsolete: âPlease change your module constructor to take a ReadOnlyTargetRules parameter, and pass it to the base class constructor (eg. âMyModuleRules(ReadOnlyTargetRules Target) : base(Target)â).â
\Plugins\iTween v0.8.7\iTween\Source\iTween\iTween.Build.cs: warning: Module constructors should take a ReadOnlyTargetRules argument (rather than a TargetInfo argument) and pass it to the base class constructor from 4.15 onwards. Please update the method signature
\Plugins\iTween v0.8.7\iTween\Source\iTween\Private\iTweenEvent.cpp(2723): warning C4996: âUEnum::GetEnumNameâ: GetEnumName is deprecated, call GetNameStringByIndex instead Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.
C:\Program Files\Epic Games\UE_4.16\Engine\Source\Runtime\CoreUObject\Public\UObject/Class.h(1773): note: see declaration of âUEnum::GetEnumNameâ
Ah, thank you tosith. I have updated the plugin for 4.16 - it should be 4.17 compliant no problem when the time comes. 's the download for the updated plugin, compiled for 4.16: Mega
The first is null ref exception in [FONT=Courier New]UiTween::SpawnEvent(AiTAux* aux), where it doesnât check if the player controller is null before trying to get its pawn.
Iâm not sure when/why there wouldnât be at least one player controller, but we managed to have it happen a few times (maybe when PIE is being torn down?)
Another crash/hang that happens a few times a week is in [FONT=Courier New]UITween::StopTweeningByEventReference(AiTweenObject* object), where Array complains that the length of the currentTweens array changed during the for each loop
This one doesnât always cause a crash, but will at least hang of a couple of seconds. I seemed to be able to fix by just not calling [FONT=Courier New]EndPhase() inside the loop itself.
On a related note - have you thought about putting iTween on GitHub so we could post issues there and possibly submit PRâs to save you some time? The email notifications would be a lot better than too
Anyway, thanks!
Geordie
Edit: Just found another bug I think? Our game uses a lot of slomoâs, and so UI animations often need to ignore time dilation.
But I discovered that tweens that played while the global time dilation was eg. 0.1, would actually play significantly faster than they were meant to.
I had a look through the iTween code, and it seemed like the time dilation was actually being compensated for twice - first by setting a CustomTimeDilation on the tween event actor, and then again in the eventâs Tick?
Commenting out the actorâs CustomTimeDilation (so just relying on compensation during Tick) seemed to fix.
(I think using Tick to compensate is probably more flexible since the time dilation may change while the tween is running, so setting it once up front wouldnât actually âignoreâ it properly)
Just got back from a long halt in my game, and updated from UE 4.14 to 4.16 and the plugin too. I canât see any errors, but in an Android packaged build, no tweens seem to work at all anymore? Iâve tried with easing and without, and couldnât get anything rolling. It works in the editor though? Iâd appreciate if you have any insight of whats going onâŠ
Hi! Thanks for this plugin! I sone of the best out there!
I just need an answer for a stupid question. Iâm using Itween within a Function and I canât use delay node after every Tween. There is a command inside Itween node where I can decide âgo on with the flow data only after the move from/to node is complete?â
You canât use delay nodes within functions as they rely on a tick to delay (functions have no concept of tick). You would need to do this within an event instead.
Hey all. I took a break from my game since 4.14 but now want to get back into it - 4.18 and I canât compile iTween anymore on either Mac or Windows - far too many errors now.
Can anyone get it working or does more work need doing on the source code?
Hello stansdad, I have a 4.18 build of the plugin and it works fine (even with a warning messages) for shipping builds. If is ok, I can send it to you. For 4.19 through, I think there will be need for a proper changes in the code of the plugin.