Unreal Engine - Timeline-Based Moving Platform Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hey it's Sun bringing you a Unreal Engine tutorial so in this video I'm going to show you how to make a timeline based moving platform so if I quickly hit play you can see a platform moving up if we follow it for a couple of seconds you'll see it eventually come back down again and what's happening is we're using a timeline in Blueprint to drive the logic for this so without further Ado we'll go into it now so the first thing we need to do is create an actor to do so that going to side a Content draw if you've got a folder right click in the content draw and one of the spaces here and then choose a blueprint class and then pick actor what I'm going to do for mine is I'm going to call mine BP uncore moving platform version two now if you followed the previous tutorial the version one was the one that used the interp 2 movement components but this one we're using a timeline so give that a name double left click to enter it once it's there you can dock it in the viewport but then it'll be an empty actor with a default scene route and nothing else in it next thing we need to do is we need to add a static mesh to give it a visual representation so static mesh and what I'm going to do is I'm going to use the champer cube again and I'm going to pretty much do what I did last time scale it on the X and Y AIS to two and then I'm going to put 0.1 on the z-axis here once that's done hit compile and then what I'm going to do next is I'll take us into the event graph now that we've um in the event graph what I'm going to do is I'm going to use the event begin play noes but I don't want these two nodes event tick or active begin overlap they're not needed so I'm just going to delete those so using the timeline version means that we need to record the access location at the start that way it has an origin point and it knows where the platform is moving from so to do that we're going to store that as a variable right click in the graph choose get access location if you go to the return value pin right click promotes a variable and what we want to do is we want to grab this set to location and we want to store it into this Vector variable we just created and we're going to call the vector variable start location next we want to do is we want to create two events in this case I'm going to use two custom events to do this right click in the graph choose add custom events and this one I want to call move platform to ends location right click again type in custom add custom event and then the next one is going to be move platform to start location these will make sense as we go along the tutorial but for now we'll just keep them as they are next thing we need to do is we need to create a timeline and this is going to be the the main driver of moving the platform right click in the graph search for a timeline adds timeline hit enter just call it timeline and what we'll do is to in order to add some logic to this we're going to double left click onto it and it's going to take us into the in the timeline itself so there's a few buttons here that control basically the frame rate if it Loops um if it's replicated time dilation even what ti group it operates on but for now I want to add a vector track to do this click on the track button add Vector track and while we're here uh just call it new track zero oh I can't okay just go new track one I'm going to change the length to be 10 set and what I need to do is I need to basically add something to the z-axis um I want the platform to move up and down if you choose another axis that's fine just make sure that you lock the other Curves in order to get it to move the direction you want so in this case I'm going to lock it on the X and the Y and that'll just leave me with the zco so now that I've done that I'm going to click on the line and hold I'm going to hold shift left Mouse button and I'm going to do it again and create another Point somewhere over here select the first point and I'm going to make the time 0 seconds and the value of zero select the second value choose the value of 10 oops and I'm going to move that 1 th000 units now first you won't see the line you'll see it sort of if you look very closely going up here in order to make this make appear click Zoom to fit horizontal and then Zoom to fit vertical and as you can see you now have a a line Bas UPS going from zero up to 10 seconds and the value 1,000 hit compile and that's basically our timeline ready to go if you look at the timeline you'll now see our Vector track appears underne Direction so next thing we need to do do play from start plug move backform end uh end location into this uh node what I want to do is I want to get the this value and add it to our start location so if you hold control you can drag that in as as a GTO press plus and you want an add operator and then plug your new track into there and then set act to location drag update into this and that's pretty much the logic race go however the two events move back and forth and we don't have any system detecting that and its current state in the timeline it'll just go from zero move thousand distance over 10 seconds seconds so how do we know when to reverse this well the timeline can do that for us so if we drag off Direction here and then look for a switch on timeline direction we can actually get something that can determine where to move backwards and forwards so we have a two events here if we're going forward and we finished we want to move platform to start location to go backwards however if we're going backwards from 1,000 to zero we want to move the platform to the end position plugin move platform to start location and that will reverse it from the end so quick explanation when it starts it'll play from start once it finishes it'll notice that it's gone forward and then say well okay then I've moved forward I've reached the end now I need to move back to the start location the timeline will fire reverse it to the end the timeline will be set to moving backwards and then one reaches once it reaches the end and finishes it says well I was moving backward now I need to move forwards again or move it back to the end location so it'll make sense um as you experiment one last thing we need another event here to be called to make this start and this is going to be move platform to end location hit compile hit save if you have to and then what I need to do is I just need to drag this into the map so I'm going to put it around here so that we can see it um we see it when we start so let's give that a test run see what happens so as you can see platform is moving up should move th units so after 10 seconds has passed it'll reach the top and it'll come back down again give it another few seconds and yeah so pretty much the the platform is moving in a loop and it's all being driven by the the time timeline logic here and if I wanted to add any other changes to this you could go in the timeline and if you want to have a bit of ease in ease out you can select the two nodes by control selecting right click going to Auto and what you'll see is you'll see the timeline you'll see ease in and get faster as it reaches to the top you see it's low in gradually and then back on the way out it gets faster
Info
Channel: Ant's Unreal Tutorials
Views: 1,498
Rating: undefined out of 5
Keywords: #UE5, #Unreal Engine, #Unreal Engine Tutorial, #Moving Platform, #Epic Games, #Platformer Games, #InterpToMovementComponent
Id: P5gW3MXUqsk
Channel Id: undefined
Length: 9min 50sec (590 seconds)
Published: Sun Oct 01 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.