Intro to Level Creation: Blueprint Doorway | 09 | v4.7 Tutorial Series | Unreal Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
♪♪♪ (Wes Bunn) Hey everybody, welcome back. In this video, we are going to be doing a little bit of Blueprint scripting to get the functionality that we want for our sliding glass door. Now, Blueprint scripting is Unreal Engine 4's visual scripting system, as the name suggests. If you are not a programmer or don't have a C++ background or know any form of code, Blueprints are a handy way to kind of visually script any kind of gameplay sequences or gameplay events in a very easy-to-use manner. There are several videos that cover Blueprints. We are not going to cover the history of Blueprints in this video; we are just going to do enough to get you going here. Let's go ahead and just continue with our office example here. The first thing that we are going to need to do actually though is over in the Modes panel, we are going to grab a Box Trigger. So let's go ahead and grab a Box Trigger and drag that into our level here. What this is going to allow us to do is that any time the player enters this Box Trigger, through Blueprints we can call some script to have our door either open or close. So when they enter it, we can open our door. When they exit it, it will close our door. So with that, let's actually scale up our box so that it is a little bit bigger. Press R to enter Scale mode and we are going to uniformly scale it by clicking the box in the middle and scaling it up a little bit. Something like that. Looks good enough. We are going to scale it up along the Z as well just like that; it should be good enough for our purposes. So hit W to go back to the Move Tool. Press Esc actually to deselect it. There is one other thing that we need to do to our door to actually make it movable. If we select it, the first thing is that we are currently set to Static so this object cannot be moved in game. So we are going to go ahead and change that. Click on its Mobility setting and make it Movable so that when we call it through script it will actually move. So make sure we do that. I think we are ready to start actually scripting now. So there are a couple different ways we can use Blueprints. For the purposes of this video, we are just going to do this inside the Level Blueprint which is the most common way, I guess. Well, maybe not the most common, but it may be the easiest way for our example here. (Laughter) So we are going to do that. Across the top here, we have the option for Blueprints. So the first thing we are going to do is click our Box Trigger here and make sure it is selected. Then, we are going to go to the Blueprints button up here and click it. We are going to open the Level Blueprint. Give it a second for that to open up. Once it does, you are presented with a graph. This is the Event Graph; this is where all of our script will be created. Now, yours might look a little bit different than mine, especially on this Event Begin Play node here because I think I was doing something in between videos. We are not going to worry about it; I can explain what these do really quickly. Whatever is connected to this wire on the EventBeginPlay node, whenever our game starts this node will be called and any script that follows it will be executed. You probably have a tooltip above yours; I currently don't because I was playing with it. Bad me; I know. (Laughter) We also have the Event Tick, which is called every frame essentially. So anything that is connected to this wire will be called every frame while our game is running. We are not going to worry about either of these right now; we may come back to them in a moment. For our purposes, we are going to scroll down below those. We are going to Right-click and if you recall, our Trigger Box was selected in our level. If it wasn't, just make sure that you select it and then open the Level Blueprint from the Blueprints tab. Again, we are going to Right-click and we have Add Event for Trigger Box 7, which is our Trigger Box. It has an aptly named Box 7; yours may be different, again, because I was playing between videos. It is the same thing. We are going to click the expand option here and we are going to expand Collision. Now, we have a few options in here. We have Add On Actor Begin Overlap, Add On Actor End Overlap, and Add On Actor Hit. We are actually only going to worry about these top two. So let's select On Actor Begin Overlap. Let's Right-click again and go to Add Event, Collision, and Add On Actor End Overlap. So when the player overlaps our Trigger Box, execute this script. When the player leaves the Trigger Box, execute this script. So we have what it is we want. Now we need to figure out what we want to occur when the player does overlap and leaves the Trigger Box. So we are going to hop back over to the actual Level real quick. So let's make sure our door is selected here. What we want to do is have our door move in the X-Axis direction, so I am going to hit Ctrl+Z to get it back to its default location. Again, the X-Axis is our red arrow here; you can see that by the little handy widget over here in the corner. We want to have it move in the X-Axis direction. Ctrl+Z one more time. (Laughter) We can also look in the Details panel and you can see all of our values are currently specified in the Transform section of our Door. So right now, our X is currently sitting at -936. Now we want to move our door in this direction. We don't know how much, so let's just slide it over there and watch our X value here. So I am going to grab it and slide it over; you can see it is starting to go down as we continue to move it. We could move it all the way over to say -836 actually and see what that does. So our door is right about there at -836. We could slide it a little bit more, so let's actually do that. Let's actually go to -826. So our door would open to about this point, which looks good for us. So -826 is our value, so let's go back to -936 which was our default value. Let's get it back up there to -936. So -936 is our default value, so 110 meters of movement is what we need for our X. So with that, let's hop back over to our Level Blueprint. We are going to Right-click and we are going to scroll all the way down to the bottom, and there is an option called Add Timeline. So let's go ahead and add this. You can see the tooltip here that says Timeline node allows values to be keyframed over time. So values being the value of our X for our door, which can be keyframed over a specified time. So this will make more sense once we add it; let's go ahead and add it. Let's add a name for it. Let's just call it DoorMovement. Now, the node itself is pretty self-explanatory if you look at it. There is Play, Play from Start, Stop, Reverse,. etc.; it looks pretty self-explanatory. So when the player overlaps our Trigger Box, we want to play our Timeline. So I am just going to Left-click and drag from this executable pin to this executable pin. Conversely when we leave our Trigger Box we want to reverse, so play in our current position backwards so the door will close. So there is our Timeline. That is all we need to do really for this point. I think we are good. Well, there is one more thing actually. (Laughter) We need to actually add some functionality to our Timeline because right now it doesn't do anything. It plays and reverses, but there are no values specified for our Timeline here. So let's Double-click on our Timeline actually to open it up. So if we Double-click on the Timeline, now we are presented with our curves editor, essentially. I guess I should have mentioned that a Timeline actually allows us to tap into our animation curves, which is what we are going to be adding here. There are a few options across the top; we are going to click this one here, which is a Vector Track. So go ahead and click that. The Vector Track will allow us to represent position in X, Y, and Z space, which is what we want. So for our name here that it is prompting us, let's just add a name. We will just call it Movement. You can see there are some icons up here that represent X, Y, and Z. Again, we only want to worry about the X. So we are going to click the lock icon next to Y, and we are going to click the lock icon next to Z to prevent us from adding keyframes for those. In fact, we are actually going to hide them as well by clicking those eye icons. Now what we are going to do next is inside of the Timeline here, we are actually going to hold Shift and Left-click. It doesn't matter where you do it because we are going to enter in some values. You can see a keyframe has been added. At the top, we have two boxes to enter values. We have Time and we have the Value. For the Time for this first keyframe, we are just going to enter 0. For the Value, we are also going to enter 0. So at time 0, our value is 0. We are going to hold Shift and Left-click inside the Timeline again to create another keyframe. For this one, we are going to specify a Time that we want our door to open and then we are going to specify the actual Value that the door should open. So for our Time, we are going to guess we want say 1.2 seconds for our door to open. That is how long it will take for our door to open. Hit Enter. For the Value, if you recall we needed 110 meters of movement, so let's go ahead and enter 110. Once we do so, our keyframe kind of disappears. It is there; we can get it again by clicking these two little boxes here: Zoom to Fit Horizontal and Zoom to Fit Vertical. There is our line representing our two values over the specified 1.2 seconds. There are two more things we are going to do actually. The first is we are going to check this box here that says Use Last Keyframe because we want to end once we hit this keyframe. The next thing that we are going to do is hold Ctrl and select this point here so that we have both of our keyframes selected. Then, we are going to Right-click on the keyframe and there are a few options for Key Interpolation. I will explain this in a moment. We are going to select Auto and what that will allow us to do is get a nice smooth transition from our two points. So with that, I think we are done with our Timeline. Let's go ahead and close this. We are about 10 minutes into this video. I think we are going to break here because we are going to do a little bit more script in the next video to finish off our sliding door movement. So with that, let's hit Ctrl+S to save really quickly. Let's pause here and in the next video, we will finish off our script for our sliding door. We will see you in that video. ♪♪♪
Info
Channel: Unreal Engine
Views: 68,265
Rating: undefined out of 5
Keywords: Unreal Engine, Epic Games, UE4, Unreal
Id: 7Mzz6Ihivc8
Channel Id: undefined
Length: 11min 0sec (660 seconds)
Published: Mon Apr 20 2015
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.