C++ Timelines Tutorial Unreal Engine 4

Sdílet
Vložit
  • čas přidán 22. 08. 2024

Komentáře • 42

  • @donns7302
    @donns7302 Před 3 lety +1

    2021.August.. this is the best ue4 c++ tutorial ever. it's got so much details in it... need more tutorials like this THANKS for the video

  • @jimmyt_1988
    @jimmyt_1988 Před 6 lety +1

    Lovely, thanks mate. You've compressed about 5 hours of learning into a 30 minute video. Brilliant.

  • @skylord4248
    @skylord4248 Před 2 lety

    5 years have passed, but this is still helpful tutorial. Thank you, m8

  • @gekkepeer6567
    @gekkepeer6567 Před 6 lety +1

    Great tutorial, refreshing to see an actual explanation and not just a guideline on how to create it.
    Keep up the great work!

  • @DevGods
    @DevGods Před 4 lety

    3 years down the line and this tutorial is still helpful! Thanks man!

    • @Upri5e
      @Upri5e Před 4 lety

      how did you manage to get around the error when having FOnTimeLineFloat InterpFunction{} ? i get this error error C3646: 'InterpFunction': unknown override specifier

    • @DevGods
      @DevGods Před 4 lety

      Hassan Khazaal I used this tutorial to understand Timelines so that I could convert a blueprint tutorial to c++ I haven’t completed it yet and if I run into any errors and fix them I’ll get back to you. Should be in the next couple of days

    • @Upri5e
      @Upri5e Před 4 lety

      @@DevGods alright thanks ! but if u dont mind me asking, which bp tutorial are you trying to convert ? cause im trying to do that for the wall running tutorial
      EDIT: I found the fix for the issues and its working really smooth now ! its only minor issues, if anyone having problems with it just hmu

  • @r3klessgaming995
    @r3klessgaming995 Před 7 lety

    awesome please do more of these. really clear and easy to follow and there isn't enough decent c++ tutorials around

  • @maheeraeron9609
    @maheeraeron9609 Před 5 lety +1

    Not sure if you reiterated this, I know you did this- I just wanted to point out that the functions that your timeline will use (in his instance, TimelineFloatReturn(float value)) MUST MUST MUST be declared as UFUNCTION. Not sure if I missed you explaining it, but the timelines in c++ will run nothing when calling Play on a function binded to a non-UFUNCTION function.

    • @YawLighthouse
      @YawLighthouse  Před 5 lety

      Exactly, this is because its using Unreal's delegate system uses Unreal's Reflection system which requires the function's bound have to have UFUNCTION on them even if there is nothing in the parameters.

  • @turkermustafaklc9085
    @turkermustafaklc9085 Před rokem

    10:08 you just told how I felt yesterday

  • @opesanec
    @opesanec Před 4 lety

    i am really grateful for this video as it has saved me a lot of time, thanks a lot :)

  • @kenlenel3233
    @kenlenel3233 Před 2 lety

    Awesome Man

  • @pro.giciel9084
    @pro.giciel9084 Před rokem

    I crash when MyTimeline->Play(), don't know why I bind like in the video. I tried with a FTimeline struct instead of a UTimelineComponent and it works

  • @JaskanFactor
    @JaskanFactor Před 2 lety

    and he ends by saying, if you guys want to get more complicated with that, thats on you.

  • @heavyrainstudio5798
    @heavyrainstudio5798 Před 3 lety

    Very simple, thank

  • @markm4120
    @markm4120 Před 3 lety

    Great tutorial, thanks!

  • @eastprodigy1183
    @eastprodigy1183 Před 3 lety

    Fantastic tut video! although I have a question, why is it that my C++ actor does not move when I throw it into the world scene? How do I assign from the code to select fCurve by default on construction?

  • @Titan_prod
    @Titan_prod Před 6 lety

    It's awesome!! Thank you!!

  • @digimikeh
    @digimikeh Před 3 lety

    Hi, is there any performance loss when you create a C++ based BP class ?..
    Why did you created from AStaticMeshActor if the thorus is movable?.. Thanks!

    • @YawLighthouse
      @YawLighthouse  Před 3 lety +1

      I used a AStaticMeshActor because I didn't want to spent time setting up a static mesh component and making the tutorial more complicated for anybody who doesn't fully understand Unreal. The static mesh actor by default has a static mesh component setup and all I have to do is set the mesh in the editor.
      There is no real performance losses when you subclass from C++ to Blueprint. But performance will always depend on your own code and what your trying to do since UE4 is pretty optimized now when it comes to Blueprint

    • @digimikeh
      @digimikeh Před 3 lety

      @@YawLighthouse ok got it.. thanks so much.

  • @TheOriginalMomos
    @TheOriginalMomos Před 6 lety +1

    Really simple to understand and that's great, but with the 4.18 version of the engine, it just doesn't work. It throws me syntax errors concerning the delegates in the .h file

    • @YawLighthouse
      @YawLighthouse  Před 6 lety +2

      I completely forgot to mention this in the video, apologies for that. Simply add #include "Runtime/Engine/Classes/Components/TimelineComponent.h" at the top of your header file and it should work. I have it in the description of the video incase anybody needs to get that include file path immediately.

    • @TheOriginalMomos
      @TheOriginalMomos Před 6 lety

      Ah no worries! Thanks for the reply! Though I gotta ask, now Visual studio's intellisense throws me some errors about the class Uobject not having BeingPlay member or Tick. I know it's just a false positive basically because it compiles just fine, but still worth asking if you know if there's a way to get rid of errors like that.
      Thanks!
      EDIT: Also I noticed that FTimeline is also a thing and seems to basically do the same thing as UTimelineComponent. Though with internet and the official doc, I fail to see the difference outside of one is a struct and the other one a class.

    • @YawLighthouse
      @YawLighthouse  Před 6 lety

      If you have the unreal project open, in the level editor at the top go to File>Refresh Visual Studio Project Files.. this will reload VS and a dialog box will appear, just select the one thats closer to overriding instead of saving another file.
      If you dont have the project open, go into your file browser go to the uproject file and right click on it and select "Generate Visual Studio Project Files" this is basically the same thing.
      FTimeline is something that the TimelineComponent uses within it. Plus components can tick and and structs cannot unless you implement that yourself, but at that point your fighting the engine instead of working with it, the best way to figure out those sorts of things is to just go into the engine source files and look at what they're doing with both of them and understand it from there... after all alot of those classes are already there just to speed up development time so your not making those tedious things over and over. Hopefully that helps answer your question :)

    • @TheOriginalMomos
      @TheOriginalMomos Před 6 lety

      Hello, hello!
      It sure did! Thanks a lot for that.
      Now I do have one last question after stating watching another tutorial about rotating doors with C++ Timelines. Except for preferences, is there any difference really between declaring the delegates the way you did in the video and declaring the delegates in the if statement of the curve?
      EX:
      if (CurveFloat)
      {
      FOnTimelineFloat ProgressTimeline;
      };

    • @YawLighthouse
      @YawLighthouse  Před 6 lety +2

      The way I did it was both for learning purposes and if you wanted to have access to that delegate again without creating a new one in memory and just reusing it if I wanted to keep things performant the way you stated is if you didnt need to access it again or if it doesnt really have much of a footprint on performance. Both ways are honestly fine, just remember that when it comes time to garbage collect or if your having performance issues those kinds of memory saving choices do help in the long term :)

  • @zotman3293
    @zotman3293 Před 5 lety

    Is it possible to do that with an actor class which contains 2 statics meshes, which animations works together ?

  • @romankot1185
    @romankot1185 Před 4 lety

    Can i start time line on a callable function instead on begin play?

    • @YawLighthouse
      @YawLighthouse  Před 4 lety +1

      You totally can do that, I just put it in beginplay for learning purposes. You can simply make a function to start it and make sure it's marked BlueprintCallable to be able call it in Blueprints :)

  • @joonwild
    @joonwild Před 5 lety

    Thank you for this tutorial! In the part of declaring FOnTimelineFloat and FOnTimelineEvent, what does {} mean?

    • @YawLighthouse
      @YawLighthouse  Před 5 lety

      It's basically a voided function definition, because delegates in unreal require to be bound to something even if it's a void function that does nothing, at least it's bound. You can actually see an example of this in blueprint with timer delegates where if you create the variable, add tick node on any actor (cause this is just to test) then from that add a branch that checks if the timer delegate is valid and add a breakpoint on that branch. Hit play and when it hits it, when you hover over the variable it should be null and show () or {} sorry, I'm on my phone and don't remember the exact symbol... But that's basically a void function that does literally nothing.

    • @YawLighthouse
      @YawLighthouse  Před 4 lety

      @computer brand no they are delegates, that are bound to functions that have UFUNCTION() above it

    • @YawLighthouse
      @YawLighthouse  Před 4 lety

      @computer brand yes like event dispatchers, it's basically an object that binds to functions(that have the correct parameters) and you can those functions that are bound to it by using the Broadcast (or in blueprint calling the dispatcher) function on the delegate. I do suggest looking at the documentation and looking up other tutorial videos that can give a better explanation than I can :)

  • @dennismozart5134
    @dennismozart5134 Před 4 lety

    Is it possible to have an timeline without a curve attached to it? Like just set the timeline length and use that length into the update? Instead of manually needing to create a curve with a static length?

    • @YawLighthouse
      @YawLighthouse  Před 4 lety

      Its possible in theory, I haven't done that yet(or found a need to) in the time I've worked with the engine but you should be able to build out a spline in code using points(because timelines are based around curves) and just create a curve using that spline. I don't understand what you mean by using the length into the update.

    • @dennismozart5134
      @dennismozart5134 Před 4 lety

      @@YawLighthouse for example, I'm creating a skill tree/skill functionality and this timeline would be used for the cool down effect, I was able to do it with blueprints basically by just adding a new timeline and without any curves or values inside of it, I was just setting the length of that timeline and then using this length value on the update and finish to stablish whether the cool down is done or if it's in place yet
      Unfortunately I was not able to fully bind in c++ because it always require some sort of curve to stablish a static value for the end of the timeline. I eventually found the only solution by creating the entire timeline functionality in c++ and once I expose this into a blueprint I actually create another empty timeline and set that variable into my c++ variable... That was the only way I found to use variable timings on timelines in c++ so far :(

    • @dennismozart5134
      @dennismozart5134 Před 4 lety

      @@YawLighthouse if CZcams allowed me to actually post a picture or something, I would to illustrate a little bit better what I mean and its purpose... Im pretty sure that there's a better way of doing that, but my lack of knowledge for now is bringing me to this path of creating an empty timeline in blueprints then set that into my c++ variable, this way I can manipulate the timeline length and play it without any curves

    • @YawLighthouse
      @YawLighthouse  Před 4 lety +2

      @@dennismozart5134 Ah ok I understand what you mean, Im gonna wrap the code bits in brackets to make it easier to look through if your relooking at this. So I looked in the source code (this was on version 4.25.1). I'll try to upload a quick video soon to show this off so people dont have to dig in the comments for it :)
      1) You would need to declare an [FOnTimelineEvent] delegate signature(luckily you dont need to put brackets next to it because it can be used in BP) and then setup a function to bind it to that returns void and has no parameters(this will work with BlueprintNativeEvent and ImplementableEvents).
      2) Then to setup the timeline, use [BindUFunction] on the delegate to bind it to your function. Then on the actual timeline component use [SetTimelineLengthMode] to set it to use the length of the timeline and not the last keyframe which does not require a curve) and then use [SetTimelinePostUpdateFunc] to bind the timeline's update to that delegate(which will fire the function that its bound to).
      3) To set the timeline length you can just use the function [SetTimelineLength] on the timeline component.

  • @freakinkawaii1039
    @freakinkawaii1039 Před rokem +2

    Update 2022: if its not working for you. try this.
    FOnTimelineFloat UpdateFunction{ };
    UpdateFunction.BindDynamic(this, &AFloatingActor::UpdateZOffset); //UpdateZOffset is Address of Function That takes Float