00:00Hello guys, and welcome to the Unreal Engine 5 Blueprint for Beginners tutorial
00:04In this video, I will explain what blueprints are, why you should learn them, and how to use blueprints within Unreal Engine 5
00:13I will show you step by step how to create some blueprint actors, such as this door, these health and damage boxes, this soccer goal, equipping this hat, and much more
00:24This video is designed for complete beginners with no experience, so without further ado, let's get right into the video
00:38 Alright, so if this is your first time in Unreal Engine, first of all, make sure you obviously have the Epic Games Launcher (link in the description)
00:44Make sure you have Unreal Engine 5 downloaded
00:46You just navigate to the Unreal Engine tab, and select Unreal Engine 5
00:51and then download early access
00:56Once you have Unreal Engine downloaded, you can go ahead and click Launch right here, or you can launch from the desktop
01:01In here, we're going to click on the Games tab and select the Third Person template, making sure this is set to Blueprint
01:11We're also going to ensure we include the Starter Content, then name this Blueprint Beginner and click Create
01:16Okay, so first I want to explain, what is Blueprint? Blueprint is the visual scripting system of Unreal Engine
01:24It can be used to create pretty much anything—for example, cars, weapons, gameplay mechanics, user interfaces, AI, and much more
01:32Let me show you what a Blueprint looks like
01:35Right now, we have our Third Person example
01:37In our project, we can hit play, and as you can see, we have our character
01:44We can move our camera around our character, use WASD to move our character, and press the spacebar to jump
01:51This is a really simple character, and all of this is made in Blueprint
01:54So, how does that work? If we press Escape, here, we can click on this character, right-click, browse to asset
02:05This will bring up our Content folder, then Third Person Blueprints, and our Third Person Character Blueprint right here
02:13This is essentially a Blueprint class
02:15It contains all of the logic for what we just saw: the camera rotating around the character, moving around, jumping—all of that logic is built inside this Blueprint class
02:26So I can go ahead and..
02:29Double click to open that class, and we're going to see the blueprint window now
02:33I'm going to take this little tab and dock it here at the top, and I'm going to start explaining everything that you see here
02:40Alright, so this is the default Blueprint editor, and we're going to start out right here with these three tabs
02:47First, we have the viewport, so you can see this is actually our character that we saw in our scene
02:54We can move around the viewport by using W, A, S, D, just like we would in our normal viewport
03:00We can also select items by left-clicking, and you'll see it highlight in this Components tab
03:08So, you can see we have our character, this Capsule component, and our camera
03:16You also have your usual scaling, rotating, and..
03:20Translating so we can select our character, we can scale our character by pressing R to scale up and down
03:26Control Z to undo
03:33We can move our character by pressing W and moving it around, and then we can also click E to rotate our character
03:39So, we have all the basic controls that we have in the viewport
03:48We also can adjust, obviously, our camera speed so that we don't fly super fast around, and we can also hit F to focus in on the object that we have selected
03:56 So, let's talk about these little components we know first
04:02Essentially, a Blueprint is made up of these components, and it's also made up of Blueprint nodes
04:07Components can be physical objects like this, where we have this Capsule component
04:14This is supposed to be the..
04:16For our character, we have an arrow component so we know which way is forward
04:22Our character's mesh has its animation, so we can see our character walk around, run, and jump
04:30Then we have our camera boom, which determines where the camera should rotate around the character, at what length, and at what rotation point
04:38Next is the actual camera, through which we see our character
04:42Below that, we have the character movement component, which tells us how to move our character around the game
04:51You might have noticed that when I select different components, we have this little details window on the right
05:01The details window provides various details about our different components
05:06So, you can see here we have our character mesh selected, and we can see our character's scale and rotation
05:14We can actually adjust our character's scale, and we can also adjust our rotation
05:22Then, we have our animation, our actual mesh model, our materials, and so on
05:29There's a lot of different things here for each component—a lot of details that you can tweak
05:38Alright, now moving on, we have the Event Graph
05:40The Event Graph is where all the blueprint nodes are stored
05:45A blueprint node is basically telling us to perform some sort of logic
05:54For example, this jump event—this input action jump—when the character presses the space bar, our character will jump
05:59When the space bar is released,..
06:04It will stop jumping
06:08Then, over here, we have our movement
06:12When we move our character by pressing W on our keyboard, it's going to move our character forward
06:16And then, when we press left or right, it's going to move our character left or right
06:22All right, there is a third tab right here, which is the Construction Script
06:25Now, the Construction Script is a little bit different from our Event Graph, and what I mean by that is everything on our Event Graph is executed in the game
06:36So, this means all of the Blueprint nodes in here are executed when the game starts and is running
06:42When the game is running, okay? So, in the Event Graph here, you can also right-click to pan around and then use the middle mouse button to zoom
06:52The Construction Script, everything
06:56Off of here is executed before the game even starts, alright? So those are our three basic tabs: our VEX port, where we can see what our blueprint is made of; our different components; our event graph, where we can see all of our blueprint nodes and functionality; and our construction script, where we can add things that happen before the game starts
07:20Okay, so here on the top bar, I'm going to start over here from the left to the right
07:25We can have our compile button
07:31Right now, you see this little yellow question mark, which means that our blueprint needs to be compiled
07:36When we hit compile, you can see we have a green check mark
07:41So every time we make a change in our blueprint, we have to hit that compile button, and..
07:44The button is doing its job; it runs through all of our Blueprint nodes and checks for any errors
07:52Then we have the Save button, which saves our Blueprint so we can see the changes happen in our game
07:59We also have the Browse button, which is pretty standard for all classes in Unreal Engine
08:06If you click it, it will automatically show you the Third Person Character Blueprint that we're currently editing in the Content Browser
08:17Okay, so we have a couple of other options: you can find certain nodes within our Blueprint, hide nodes that we don't want to see, and access our Class Settings and Class Defaults
08:28We also have our Simulation, which allows us to simulate what's going on, and then we have our Play button, which is just..
08:39Playing in a new editor window or game
08:40All right, and then over on the right again is our Details panel, so as we select different objects, we can pull up different details on those objects
08:57For example, for our components, we can see details for our camera, our character, and so on
08:59Down here is the Find Results, so we can search for different nodes in our Blueprint
09:06If we want to find our Jump node, we can see and click on the reference here, and we can see where it is in our Blueprint
09:17This is helpful because if we have a lot of stuff in our Blueprint, we can search for Jump, select it, and find it right there
09:23It will also show us any error messages, telling us what is wrong and what we need to check
09:32On the left here, we have..
09:34We have the My Blueprint tab, which shows our variables, our functions, and so on
09:38First, here we have our graphs, so we see we have our Event Graph
09:45We can see all of our different events on our Event Graph by hitting this little down arrow
09:52We can also add multiple graphs if we want to
09:57To add another graph, we can create it here—click "New Event Graph 0"—and you can see here it's a new tab
10:03We can actually close that and delete it, then compile and save
10:08If you ever close your Event Graph here, you can always get back to it by selecting and double-clicking your Event Graph, and it will show up right there
10:19Down here, we have the functions
10:20Under our functions, we have the Construction Script, which we talked about earlier
10:26We can also add a..
10:32New function: by hitting that plus tab, we can add blueprint logic here and call that function, so I'm going to delete it real quick
10:37Then, underneath, we have variables, and I'm going to skip over macros for now
10:43We also have variables down here, and essentially, a variable allows us to store data and information about our character or about various different things in our blueprint
10:56So, I'm going to go back to my Event Graph here, compile, and save
11:00We're going to go over all the different variable types
11:05First, to create a variable in our third-person character, we're going to hit this plus tab, and you can see here we have "New Var," "New 0," and it's of the boolean type
11:18So, we can go ahead and name this "Is Dead?" Here on the right, we have the Details panel, and so we have our variable type
11:30We can see here all of the different types of variables that we have, and then down here at the very bottom, we have the default value
11:38It says, "Please compile the blueprint in order to assign any sort of value." Here, we have to first compile and save our blueprint
11:45Then, you can see this little checkbox
11:50If we check it, it means true, and if we uncheck it, it means false
11:54So, a boolean is essentially a true or false statement
11:57We can say whether our character is dead; true means this checkbox is unchecked, meaning false
12:04So, let's go ahead and show this by creating our first blueprint node in our Event Graph
12:12We're going to zoom in here, right-click, and you'll see..
12:15Here we have all actions for the blueprint, and you can see here we have a bunch of different options
12:20We have add event, animation, audio, character, cinematics, and all these different things
12:26So basically, we can right-click and add certain nodes, events, and functions
12:33For example, we're going to add an Event Begin Play, and you're going to see here we search for Event Begin Play
12:44We can go ahead and left-click this, and you're going to see here this Event Begin Play node
12:49So, what an event we can play is that every time we hit Play, our Event Begin Play is going to be called
12:55Everything off of this node is going to be executed
12:59And what I mean by that is, if you actually drag off of this little arrow, you can see here we have a little line, and if we let go of it..
13:11That you can see, we have our little search window where we can add another node, so we're going to add a Branch
13:17We'll go ahead and click that, and you can see here we have on our Event BeginPlay, we're going to do a Branch
13:24Now, a Branch checks to see if a Boolean is true or false
13:31So, if we select the Is Dead Boolean, we can drag it into our Blueprint node, and we can either get the variable or set the variable
13:42Now, we don't want to set the variable; we want to get it, so we'll go ahead and click on that
13:51And you can see, we can drag off of the Is Dead variable and hook it up to the Branch
13:56So, basically, what we're doing here is, when we hit Play, we're going to check and see if the player is dead
14:03If they are dead, we can do another node and type in Print String
14:08Our print string will display a little message on our screen, and you can see here the default message is "Hello." I'm going to change this to "Character is dead." Then, off of our "False" pin, we can drag out and type in "Print String," and we're going to name this "Player is not dead." Now, if we compile and save our blueprint, we can hit play, and you can see here "Player is not dead" in the top right screen
14:47It might have been too quick, so we can adjust that by selecting our node right here, clicking this little down arrow, and changing the duration to 10 seconds
14:58We'll go ahead and hide that, click this little down arrow again, and do the same thing—change it to 10 seconds
15:08Then, we'll compile and save that, so we hit play again, and you can see..
15:12Here, our player is not dead, and the reason why is because we select our boolean variable here, or right over here
15:20You can see the default value is set to false, which means that on Event Begin Play, the player is not dead
15:31Nope, print string: "Player is not dead," so you can see here, Blueprint is basically a node-based system, so we have these different nodes that we can connect together to create a simple flow of gameplay logic
15:48Now, what we can do is, we can select our variable "IsDead," check this little box to make it true, then compile, save, and hit Play
16:00You can see our character is dead
16:03As you can see here, a boolean is very simple; it has two values—either true or false
16:10Let me talk a little bit about the Blueprint Editor
16:14Graph, especially if this is your first time using the editor graph, so you can select various objects by left mouse drag
16:22You can see here we selected these objects; we can move them around in a group and select more objects like so
16:29You can also disconnect these pins here by clicking Alt and left-clicking, then left-click to drag and reconnect
16:42You can also hold down Control, click on a pin, and move it to a different pin
16:50Then we can hit Alt and left-click to unpin that
16:54We can also select objects and hit Delete, and then use Ctrl+Z to undo
17:02 Alright, so let's go ahead and talk about the other different types of variables that we have, such as the integer, string, and so on
17:11Let's go ahead and add a new variable; we're going to change this to
17:19Integer, and then we're going to name this "MyInt," so you're going to see it here at the bottom
17:23Please compile the blueprint to set the default value
17:27So, we're going to compile, save this
17:30An integer is a whole number; you see here, we can type in any number
17:36We have zero first, then we can do one, two, three hundred, five thousand, or any whole number
17:41What an integer is not is 1.01, 3.0, 0.09; it is not a decimal
17:44It is only whole numbers like one, four hundred, and so on
17:56So, for our integer variable type, we can store information such as our player level, how much ammunition our character's weapon has, and so on
18:07Okay, next up, we'll create another variable, and we'll go into the details tab and select the type
18:15Change this to a float
18:19Now we can name the variable type to MyFloat, and then we can compile and save that
18:26Now you're going to see that our float value is 0.0
18:32A float is a decimal number, so we can do 1.1, 35.3, 29.001, 0.001, and so on
18:44We can have any sort of decimal number
18:53This is very helpful for doing things like health or any sort of percentages, like 90 percent, 100 percent
19:00Okay, let's go ahead and create another variable
19:05We're going to change the variable type here to String
19:06A String is a sequence of numbers, letters, characters, and whatnot
19:13So we'll name this MyString, compile and save that
19:18Then, in our event Begin Play, we can go ahead and delete all this
19:29Drag off of here and do Print String, then we can drag "Get My String" and hook it up into the Print String
19:40Compile, save, hit play
19:42You can see our string is printed out in the top left
19:47So, a string is really good for storing text information—that is, numbers, letters, and characters
19:52Let's create another variable; we're going to change this to the type Vector and rename it to My Vector
19:58Compile, save that
20:05Our vector here, and the default value, you can see, is made up of three different values
20:12So, we have an X, a Y, and a Z
20:17You can also hit this little downward arrow, and it's the same: X, Y, and Z
20:22A vector tells us pretty much the three points on each axis of a 3D object
20:28So, if we go to our viewport here, you can see, down on the bottom
20:34Left, we have this; we have the X axis, the Y axis, and the Z axis, and you can also see this if we select our character
20:43You can see the Y, the X, and the Z
20:45Back in our Event Graph, on our vector, and to demonstrate our vector, we can do something like get world location
20:55We'll do this: get world location of our capsule component
20:58So basically, this is getting the location of our character in our scene, and it's returning this vector
21:08Then, we can go ahead and take our vector, and we're going to drag it in here
21:16Instead of getting it, we're actually going to use the set node
21:19Setting a variable allows us to modify the default value of the variable to whatever we want it to be
21:25So, we can go ahead and hook that up to my vector, and we can go ahead and delete this
21:33Right here, and click Alt + Click right there to disconnect that, then select this, drag this up here, and connect the Event Begin Play into the Set node
21:44Then, off of our Vector here, we're going to go ahead and actually print the string like so and hook that up
21:52If we hit Play here, you can see it prints our character's location on the screen
21:59We can also do something else, like deleting our Event Begin Play, right-click, and add a key, so we can type in the R key
22:11You can see here we have all the different keys on our keyboard
22:15We're going to select the R key so that when we press R on our keyboard, we get our Capsule Component, which is our character's, get its world location, set our Vector value, and then print it to the screen
22:35I can see what it is, so we'll go ahead and compile and save that
22:43Hit play
22:50Now, every time we press R, you can see our vector change on the screen because our character is moving around, and every time we press R, it's getting that variable, sending it, and printing it to the screen
22:58All right, so let's go ahead and create another variable
23:00Lastly, here we can select vector and change this to a rotator
23:06In this example, my rotator, compile
23:09You'll see here a rotator is the same as a vector, but essentially it's a rotation
23:16So, if we head back to our viewport here, if we go to E, we can rotate our character, and on the right of our Details panel, you can see our character's rotation change based on how we rotate our character
23:24You can see it here
23:33This is our rotator
23:41A rotator variable is essentially just a rotation value, okay? Now, last but not least, we can add another variable and change this to transform
23:49I'm going to do my transform, compile, and save that
23:56In the default value, we hit this down arrow, and you can see it is a location, a rotation, and a scale, so it includes all three of those variables
24:08Plus, the scale determines a transform
24:12If we head back over to the viewport and select our mesh, you're going to see that we have this transform here: the location, rotation, and scale
24:21It's just made up of those three different variable types
24:25Okay, let's go ahead and delete all this stuff that we created here—delete everything on the graph—and delete is dead
24:33My end floats, string, rotator
24:36Vector transform and compile, save that
24:37So, those are all the main variables that you need to be aware of within Blueprint
24:46Now, let's go ahead and create our first Blueprint actor
24:48We can go to our Content Browser here, and under our Content folder, we can create a new folder by right-clicking and selecting 'Add New,' then choose 'Folder.' Name this folder 'Blueprints.' In our Blueprints folder, we can open it up, right-click, and add a new folder
25:11We'll call this 'Door Blueprint.' In our 'Door Blueprint' folder, right-click and select 'Add Blueprint Class.' This is how you add Blueprints to your game
25:25Click on 'Blueprint Class,' and you'll see we have all the different Actor classes right from the start
25:32Actor, pawn, character — then we have a couple of others, which I'll have to explain in another separate video
25:42But basically, the Player Controller is where you can put information to control your character
25:48GameMode base is where you'd store all the game rules
25:53Down here, we have all the classes, so we have Animation Blueprints, Camera Blueprints, all sorts of different Blueprints, including Car Blueprints, all built right here with all the different classes
26:09 For us, we're just going to create a simple door, so we need a simple Actor Blueprint
26:13An Actor is an object that can be placed or spawned in the world — that's exactly what we need
26:20So, we'll go ahead and click Actor, and we're going to name this BP_Door, BP
26:24Because it's short for Blueprint, underscore is the naming convention of Unreal Engine
26:33It's best to adopt a naming convention so you don't have all your files just named whatever, and you can very easily know exactly which files are which
26:46Okay, so we'll go ahead and double-click our BP_Door to open it up
26:50We can dock this tab at the top so you can see here we have our basic Blueprint editor, just like our third-person character
26:56Our little viewport here, we have our Construction Script, our Event Graph, and our Details Panel components and so on
27:06For our door, what we're going to do is add a new component
27:13You can see here we have all the different components, so we have audio, we have a..
27:19A skeletal mesh is like a character mesh, while a static mesh is an object that is static, it doesn't move or do anything
27:33We have a plane, a sphere, and a cube—these are just basic shapes
27:37For our door, we need to add a simple door mesh, so we can add a static mesh and name it 'Door Frame.' Compile and save
27:48Make sure you have the Starter Content in your Content Browser
27:53If you forgot to add this when creating your project, don't worry; you can always click the add button, select 'Add Feature or Content Pack,' and then under Content Packs, add the Starter Content to your project if you haven't already
28:14So, back in our Content..
28:18Drawer, we're going to go to Prompts
28:21You can see here we have this SM_Door, this SM_Door_Frame
28:23"SM" is short for Static Mesh, so what we're going to do is assign here this Static Mesh Door Frame
28:36To do that, we can actually drag our Door Frame mesh right here into the Details panel because we have our Door Frame selected
28:44We have our Static Mesh right here
28:47Now, if we go into the viewport, you can see we have our Door Frame
28:54Let's go ahead and add another mesh; click this Add button, select Static Mesh
28:58We're going to add a door
29:01With our Door selected, we can go to our Static Mesh here and click this down arrow
29:07We have this little search window, so we can search for 'Door,' and you can see here we have our SM_Door
29:14You can go ahead and click that; you can see we have it assigned there
29:20We also have the materials, our location, rotation, and so on
29:22So, in our viewport, we can see our door is not exactly where we want it to be, and what we're going to do is move our door by hitting W to move, and then we're going to select this on the Y-axis and move it over like so
29:38You can see here it's not lining up the best, and we can't seem to get it perfect
29:44So, what we want to do is change our grid snapping value
29:47Hit that little tab right there, set this to 1, and this is going to give us more control over our snapping
29:55Okay, so that looks a little bit better
29:58We can go ahead and compile and save that
30:01Now we have our little door here and our door frame, and if we click E, we can..
30:07Rotate our door on the Z axis right here
30:12Okay, Ctrl+Z to undo, obviously
30:16Compile and save that
30:20Now, what we want to do is allow our character to open and close the door
30:24So, we can add a collision box or a box collision, and when our character runs into this box collision, we can give them the ability to open and close the door
30:41Let's go ahead and press R to scale this box
30:43If we hit the little cube in the middle, we can scale the entire thing
30:48If we select only the Z-axis or the X-axis, we can scale in those directions
30:53Okay, and we press W to move this up, scale it up a little bit, maybe make it a little wider, like so
31:00Compile and save that
31:06Now that we have our components set up, let's add the blueprint nodes in
31:12Our event graph, so what we need to do is go to our event graph
31:16You can see here it's automatically given us these events: our Event BeginPlay, Event BeginOverlap, and Event Tick
31:24These are all greyed out, but you can still use them by just dragging off and doing a Print String
31:33You can see the grey goes away because you're using them
31:36Okay, we are not going to actually use any of these, so we can go ahead and delete them
31:41Then, what we want to do is select our Box Collision, and in the Details panel, we can scroll down all the way until you see these events to see what they do
31:49Let's go ahead and move this little window right here by selecting it and moving it over
31:55Now, you can see here we have different events for different things
31:59Here on the component hit, what we're interested in is this "OnComponentBeginOverlap." So, when our character overlaps, we want to click this little plus button so we can add that event
32:11Whenever something like a character overlaps in our report here, or in a box collision, this event will be called in the event graph
32:23 What we want to do is check to see if the other actor is our character
32:26Our character, if you remember, is our Third Person BP Third Person Character
32:33Back in our door here, we want to drag off the other actor and do a Cast to Third Person Character
32:43 What the Cast to Third Person Character will do is check to see if the overlapped actor is a Third Person Character, and if so, it will execute whatever is further
32:57Off of here, and if not, it will fail
33:01So, all right, so our cast to the third-person character, we're going to do an Enable Input, and we're going to enable input for our character that is overlapped
33:17Okay, so what we want to do is get the Player Controller, and you want to hook this up into the Player Controller here
33:29Then, we’re going to check and see if it is a third-person character that is overlapped
33:32If so, we want to enable input for that character, for that character's controller, so they can interact with the door
33:40We also want to select our box and add an event for overlap, so we can disable input
33:47Then, we can do another cast to the third-person character, and from here, we can drag and do Disable Input, and hook it up accordingly
34:00Return value instead of player controller to the target
34:05Compile, save
34:11Next up, we have to add the actual key to open and close the door, so we can right-click, type in "E" key
34:17We're going to scroll up here until you find the "E" key, click on that
34:24Off of here, we're going to do what's called a "Flip-Flop," and what a "Flip-Flop" allows us to do is to do an A or B
34:37So if we press it once, it will do A, and then when you press it again, it will do B
34:44It automatically remembers which one you did last, and it cycles through A or B
34:49Now, off the "A," what we want to do is get the door skeletal mesh, and you can see we can actually drag our door component into our blueprint so we can get the references of our components and do
35:00Things with them in our blueprint, and that's exactly what we want to do
35:06We want to get our door here and rotate our door when we press the E key
35:11To do that, we can drag off of here and set relative rotation, and what we want to set this to is 90
35:21Then, we hook that up into a Select node, copy it with Ctrl+C, Ctrl+V, and connect that to the B
35:33We want to set this back to zero, so when we press E once, the door rotates 90 degrees; when we press it again, it rotates back to zero
35:53 Let's go back into our Third Person Example map, go to our Content browser, open the Blueprints folder, and select the Door Blueprint
35:58We can drag our blueprint into the level here
36:03When we hit Play, we can walk over to our door and press E
36:08You will see we can open and close the door just by pressing E
36:12Now, it might look a bit snappy because it's just rotating 90 degrees, then zero, then 90 degrees again
36:20What we can actually do is add a timeline that will smooth the value between zero and ninety, so we get a nice smooth open transition
36:35 Back in our Blueprint door, we can go ahead and delete this right here
36:43Hit Alt+Left Click on it, select that, and move it off of our "A" node
36:47We're going to add a Timeline; select this, add a Timeline, and name it "Door Timeline." You can see here we have a few different options: Play, Play from Start, Stop, Reverse
37:07Then, for output, we have our Update and Finished cues
37:11To actually modify or use this timeline, we need to double-click it to open it
37:18Right now, there's nothing
37:26Here, to add a track on the timeline, we can click "Add Float Track," okay? And a timeline is essentially exactly what it sounds like
37:34So, at zero seconds, we can set a value right here, and you can see the timeline is currently up to five seconds long
37:42So, over five seconds, we can determine and set a certain value to create a very smooth curve
37:52 Let's go ahead and right-click anywhere on our timeline; we can add a key
37:58You can see it added this little dot, and we can see the time and the value
38:03So, what we want to do is set the time to zero
38:07At zero seconds, we want our value to be zero, okay? Then, anywhere on the graph, we can right-click and add a key
38:15We want to change the time here to two seconds, and the value will be 90 degrees
38:26You can see here
38:37We can't see our value anymore, so to actually see our graph, now we can hit this "Zoom to Fit Horizontal" and "Zoom to Fit Vertical." Now, one more thing, we want to set our length here to the maximum of two seconds, so that our timeline is only as long as our value right here
38:48Then, we also want to make this curve smooth, so we can select with Shift and left-click and drag to select, right-click and click Auto
38:56This gives us this little curve, so we can select that point and drag it like so
39:05Now, you can see we have this nice smooth curve, and what this is doing is it's outputting a value of the variable type float
39:13So, we can go back into our Event Graph here
39:19You can see here, our new Track 0 outputs this value of a float
39:25What the timeline does is it says at zero..
39:28Seconds do nothing at 0.2 seconds, output the value of 12, and at 26 to 30, so it does this really nice smooth rotation to 90 degrees
39:39Back in our Event Graph, we can go ahead and hook this up
39:43What we want to do is, you might notice first off that this is a float and then this is a rotator, so how exactly is this going to be compatible? If we drag off of our rotation, you're going to see that float is not compatible with rotator
40:04To actually do this, we can drag off of our rotation and do a Make Rotator
40:18You're going to see here it has these X, Y, and Z, which are float variables that we can use
40:23They are actually compatible with our door timeline
40:28Off our new track zero, we're going to hook this up to the Z because, remember, we want to rotate our door on the Z axis right here, and that's the reason
40:33Why, you know, the Z-axis is indicated by the color; it's blue, and you can see Z right here is blue
40:40So, back in our Event Graph, we've hooked that up
40:42We want to plug the update into the Set Relative Location node
40:48One more thing, off of our branch, we want to play the timeline in reverse
40:53Okay, so we can compile, save this, go back into our level
40:57We hit play, then press E; you can see our door opens and closes with a really nice smooth rotation
41:04Again, the way this is possible is because we're playing this timeline that has a smooth transition between these two values, 0 and 90, and it's outputting that value every second to set the rotation of our door
41:25So, we get that nice, smooth door open animation
41:29So, that's pretty much our door blueprint in a nutshell — a very simple setup
41:36Open and close is made entirely from Blueprints using components and Blueprint nodes
41:41Alright, so let's do something a little bit more challenging
41:46Let's go ahead and make a hat pickup actor
41:54First of all, make sure you obviously have the Blueprint beginner project files downloaded
41:57I'll leave a link in the description below
42:02 What we want to do is open our Content Drawer
42:06We're going to dock it in our layout so that we can see our Content Browser at all times
42:13Okay, in our Content, we want to add a new folder and call this "Project Files." Then, we can select everything in the Project Files that you have downloaded and drag them right into your Content Browser
42:30Just leave
42:32Everything at the default settings, and we'll just hit Import All
42:35Now you'll see it automatically imported the materials for our static meshes, and that's fine
42:39We can leave that as is, and it will compile shaders
42:46It’s just going to take a minute
42:49All right, now that our assets are finally imported, we're going to use this little hat mesh
42:56To create our little hat pickup, we want to go to our Blueprints folder, right-click, add a new folder, and name this hat pickup blueprint
43:05Here, we're going to right-click and add a new Blueprint Class of the type Actor, and we can name this BP_HatPickup
43:15Double-click this to open it up, and in here, we're going to add a component
43:23A static mesh component for our hat, we're going to name this hat mesh, and in our static mesh, we're going to search for SM_Hat and assign it, like so
43:40We can see here we have this nice little hat
43:44All right, next up, we need to add a sphere collision, and so this collision will allow us, when the player enters this collision, to check if they press E
44:00If they do, then we can put the hat on the character's head
44:07So, let's go ahead and scale this up a little bit and move it up like so
44:11Let's actually take our hat and move it up a little bit like that, and we can scale up our hat to 1.5, 1.5, and 1.5, just so it's a little bit bigger
44:23Okay, so in our Event Graph, we're going to go ahead and delete these nodes right here and select our sphere collision
44:32Down to the very bottom and add an Event Begin Overlap, and then again an Event Overlap
44:36Very simple
44:40What we're going to do is, off of this, we're going to enable input
44:43Then, very simply, we're going to drag off of our other actor, cast to Third Person Character
44:52So again, we're going to check to see if the character is overlapping; if so, we're going to enable input
45:03Off of the Player Controller, we're going to get the Player Controller at index zero
45:09Then, off of our other actor, cast to Third Person Character, and then we're going to disable input and hook up the Player Controller to the target, like so
45:25Now, what we want to do is add our key to pick up the actor, so we'll add another key
45:31So, do..
45:37Key, and we'll actually just do the E key, so scroll up and select the E key
45:44Really, you can do any key that you want, and then we're going to drag off of the other actor and cast to the Third Person Character
45:54So, when our character overlaps this and if they press E, we're going to cast to them
45:59Now, what we want to do is equip this hat on the player's head, so what we need to do is add some blueprint nodes inside our Third Person Character
46:14Go back to your example map here, select your character, right-click, and a fast way to get to the blueprint is to click "Edit Third Person Character." That takes us directly to the blueprint
46:31What we want to do here is create a new event that we can call inside of..
46:37Our hat pickup
46:40So, what we can do is right-click, add a custom event, and a custom event allows us to do whatever we want
46:48We can name this event "Equip Hat," and then, all the logic from here, we can use to equip our hat
46:56So, first of all, let's go ahead and add a new component in our third-person character called Static Mesh, and this will be our hat mesh
47:07We don't want to set any static mesh here because we just want it to be empty for now
47:16We're going to drag our Static Mesh component onto our graph
47:19Then, we want to set the Static Mesh and hook up our "Equip Hat" to our "Set Static Mesh." Next, what we want to do is set our Static Mesh here to our hat mesh
47:32Another way we could do this is to pass the variable through the event, so we can..
47:43Actually, drag off from here and onto the event, and you can see here it added a new input for our event
47:51This is a very easy way to pass data through events back into our hat pickup
47:58We can drag off of our third-person character reference and call that event by doing "Equip Hat." You can see here we have that same exact node that is in our third-person character, and we can also set our hat mesh
48:19In here, we can actually set our static mesh to our hat—the same hat that we have in the scene
48:27When our character presses E, it will cast to our third-person character, and if we double-click this, it will take us to that event in our character
48:39So, it will pass that information to the "Set Static Mesh," which will set our static mesh here to the hat
48:44That we have in our pickup actor now, if we just do this and play this, so if we drag our hat pickup into your game and hit play and press E, you can see here we have our hat on our character, but it's not on our character's head
49:07Alright, so to attach it to our character's head, what we want to do is in our character class, we want to drag off of here and do Attach Component to Component
49:19So, what we want to do is take the hat mesh and attach it to our character's mesh
49:27Drag that into our scene and hook that up to the parent
49:34For the Socket Name, this is going to tell us where in our character we should attach it, or more specifically, where in our character's bones we should attach it
49:42I'll explain this here in a second
49:49But right now, we can just name this to HatSocket, like so
49:56Make sure you have all the capitalization correct, like so
49:59For the location rule, we want to set to Snap the Target
50:03Snap the Target, and snap the Target
50:07Now, we can hit Compile and Save
50:11 So, now what we want to do is define this socket name in our character's mesh
50:18If we select our mesh right here, we can click this little Browse icon, and this will take us to our Content, then to the Mannequin, Character, and Mesh
50:31 If we open up our character mesh, we want to move over to the Skeleton tab
50:35Right now, this is just our skeletal mesh
50:41If you don't know what a skeletal mesh is, let's go ahead and head over to the Skeletal tab right here
50:48Just click on this little button
50:50 A skeletal mesh is essentially a static mesh
50:52But instead of being static, it has all these different bones, and what the bones allow our character to do is to animate and move our mesh around, like so
51:03We can select different bones and rotate them around, and this is what allows our character to move its legs, move its head, and so on
51:09That's basically a skeletal mesh
51:15Okay, so here in our Skeleton tab, right here, we want to select our head bone
51:21If you scroll all the way down, you're going to see "Head." Right-click on there; we're going to add what is called a socket
51:31Now, the socket is what allows us to attach meshes to our character
51:36We're going to rename this "Head Socket" to "Hat Socket," with the same exact capitalization as what we had in our character
51:41Save that, and we can..
51:46Close out of that, close out of this, and now we should have everything all set up
51:52We can also, just to keep things organized, select everything and press C to add a comment, and we can name this "Hat Logic" just so we know what's going on
52:07Then, compile and save
52:10We are now ready to test this out
52:11If we hit play here, you can press E to equip
52:15Then, you're going to see there's an issue — our hat is not lined up correctly with our head, so we actually have to go ahead and adjust this
52:29Go back into your mannequin's skeletal mesh, right here, scroll down to your hat socket, and we will actually want to rotate our hat and line it up with our character's head
52:45If we were to just move this little socket around, we're not going to really get a good idea of..
52:53What it's going to be, so what we can do is right-click the hat socket, add a preview asset, and search here for SM_Hat
53:00So, we can see our hat here, and it looks exactly like the issue we had
53:05So, we hit W, we can move this up, if we hit E, we can rotate this 90 degrees
53:14Then, we hit W again, we can move this around
53:18If you don't like the camera speed, you can always change this in the viewport
53:25What we want to do is line this up perfectly, just like that
53:28So, we can go ahead and save that
53:32Now, if we hit play, we can press E, and you see here we have our hat equipped on our player
53:40One more thing—when we equip our hat, we actually don't want this hat to still be visible, so we want our hat to disappear
53:50One way we could do this is..
53:56It is in our Blueprint that when we pick up the hat, after we equip it, we want to destroy the actor
54:01This will destroy the actor itself, so when we pick it up, it will disappear, just like that
54:08Now we have a simple hat actor, and we also have a little door that we can open and close
54:21Again, very simple logic here: we're just checking to see if the player is running into the spear
54:30If so, they can then enable input, which allows them to press E, which in turn calls this event inside the character to set the static mesh and attach it to the character's head
54:39So that's our basic hat
54:49Let's go ahead and move on and create a simple damage box, some player health, and a simple health bar for our character
54:58So let's go ahead and create a new..
55:00Folder in our Blueprints, and we're going to name this to Damage Box
55:05In here, we're going to add a new Blueprint class of the type Actor, and we're going to name this BP_DamageBox
55:12Double-click it to open, and we can go ahead and close out all of our other Blueprints
55:20In our viewports here, we're going to add a simple box collision and name this Damage Box
55:31Again, in our Event Graph, we're going to delete this node and go to our Damage Box, then add an Event Begin Overlap node
55:46What we want to do is damage our character; in order to do that, we want to drag off of the other Actor and cast to our Third Person Character
56:02Then, here, we can damage our character by adding a..
56:09Health variable inside our third person character
56:12So, actually, let's go back and right-click our third person character, edit the blueprint, and in here we're going to add a new variable and change the type to float
56:26We're going to change the name to Health, compile, and save
56:33The default value we can give it is 100 for 100 HP
56:35Okay, so basically, when our character overlaps this damage box, what we want to do is get the health, and then we can do something like minus or search for subtract
56:50You want to see here, subtract the health by this value
56:57I'm going to set it to 10
57:00Then, what we want to do is set the character's health
57:09So, we drag off of the third person character, add a new Set Health node, and connect it to the health value minus 10
57:17And we want to hook up the execution pin, and then we want to do a Print String, and we want to hook the health up into the string so that it converts from a float to a string
57:36So now, if we compile, save this, go to our level right here, and select our damage box, and drag it into our scene
57:45Let's go ahead and actually scale this thing up like so
57:52And if we hit Play, we're not going to know where it's exactly at, so just so that we can see it, go back into your damage box, select the box collision, click this little search icon, and in Details, search for Hidden in Game
58:11We're going to uncheck Hidden in Game
58:14Compile, save that, and when we hit Play, we're going to see it in our game
58:23Now, if we go into the box, you're going to see it subtracts 90, 80, 70, 60, and so on
58:32Now, this is Good and all, but what I actually want to create is a damage box that continues to damage our character as long as we stand in that box
58:42So, what I want to do is go back to our damage box and, instead of doing all this, I'm going to select and delete it
58:55What I actually want to do is create an event that loops over and over until our character stops overlapping with the cube
59:03Off of here, I want to get our third-person character and promote this to a variable
59:11This will create a variable that references our character, allowing us to do stuff like cast from our character reference or call certain nodes just off of our variable reference
59:30Okay, and then off of here, we're going to..
59:43Create a set timer by event, so a set timer by event allows us to loop a certain event over and over
59:46In this case, we want to damage our player repeatedly
59:53Off of our event, we'll drag here and do Add Custom Event
59:57I'm going to name this Damage Player
01:00:00Off of our Damage Player, we're going to do a Play Damage and a Damage Actor
01:00:06We want to get our third-person character reference, hook that up to the Damage Actor
01:00:14Let's go ahead and change the base damage to something like 30
01:00:20Then, for our timer, we need to set the time, so this is every second
01:00:31We change this to, say, every two seconds, and it will play this event
01:00:36We also need to check Looping, so it plays over and over
01:00:43Then, let's go ahead and actually, if we hit play here
01:00:47You're gonna see nothing's actually happening
01:00:50It's because we can't see anything happening
01:00:52To see something happen, we can drag off of here and do a Print String, and we can print the variable that's being applied to our character
01:01:06So, if we hit play, we can see 30, 30
01:01:07You can see here it's just looping over and over, applying 30 damage to our character
01:01:17So, we actually need to go into our character and add the other half of this, which is when our character receives damage
01:01:30Right now, we're applying damage, but nothing is happening in our character, so nothing is actually affecting our health variable
01:01:37We can add here an event called Event Any Damage
01:01:42So, if any damage is applied to us—in this case, the Apply Damage node—then..
01:01:48Applied to this character, it will call this event automatically, and these are events that are built into Unreal Engine
01:01:57Off of our health, we can get our health, then perform a subtraction, subtracting the damage received from our health, and then set our health to that value and hook that up like so
01:02:02Lastly, we want to do a Print String so that we can see what's happening
01:02:08Compile, save, and hit Play
01:02:21Now, if we stand in this circle, every two seconds you'll see our health decrease to 70, 40, 10, and you see it goes into the negatives
01:02:34Alright, so this is cool and all, but let's actually set up a health bar so that we can see— instead of having this Print String, we can actually see our health decrease
01:02:47On our screen, so we can add here in our Content Browser, right-click, add a User Interface widget blueprint, and we can name this Health Bar_W for Widget
01:02:59I will click that to open it
01:03:03Now, this is the widget editor; this is for the user interface
01:03:12There are a lot of things here, and I'm not going to explain everything in this video because this is mainly about Blueprint
01:03:19But basically, I'll give you a basic rundown
01:03:27This is like your screen if you're looking at your player screen, and basically, we can add buttons and other elements onto our screen to create a user interface
01:03:34In this case, we want to add a progress bar, which will be our health bar
01:03:41So, we scroll in here, drag our progress bar to something like that, and then we..
01:03:46Actually, I want to move our anchor right here, so on the right anchor to the bottom left of our screen, we take this little anchor and drag it like so to match it up with our health bar
01:04:02Like so
01:04:04And the reason why we want to anchor it is so that if we play it in a different window or whatnot, it will know where to scale this little progress bar
01:04:15Our progress bar is not going to be in the middle of the screen, on the side, or off the screen
01:04:22Okay, so we have our little health bar here
01:04:26In the details here, the progress—so you can scroll the percent
01:04:28You see our health goes from left to right
01:04:31So we have 100 percent, which is completely full, then we have zero, which is empty
01:04:35So what we can do is we can actually bind our percent to our player's health value
01:04:41To bind this all, we need to click on the percent, create binding, and then here you can see we actually have a Blueprint editor graph, similar to our character graph here in our user interface
01:04:56We can add elements like blueprints
01:04:57In this little progress bar function, what we want to do is bind our character's health to the percent
01:05:06So, what we can do is right-click, get the owning player pawn, cast to Third Person Character, and then from there, we can get the health
01:05:17Instead of directly connecting this to our value here, we need to convert it to a percentage because the output value is between 0 and 1, while the health value is between 0 and 100
01:05:37Therefore, we need to multiply this by 0.01
01:05:43Hook that up to the return value and connect the execution into the return node
01:05:53Compile and save that
01:06:02Now, in our third-person character, we need to actually create this widget on our screen, so we can add an Event Begin Play, and what we want to do is create the widget
01:06:12This will create the widget that we just made and add it to our screen
01:06:21So let's go ahead and select our Health Bar widget for the owning player, drag off of here and get the Player Controller
01:06:30Then, after this, we need to drag off the return value and do Add to Viewport
01:06:37This will create our widget and add it to our viewport
01:06:41Compile and save that
01:06:44So, hit Play
01:06:48Here, you can see our little health bar on the screen, and you're going to notice it's full at 100 HP
01:06:57Because that's our default value in our character, so if I move into here, you're going to see our health is decreasing by 30, 40, 10, and negative 20, and so on
01:07:12You can see here that our health is updating because we bound the progress bar percentage to our character's health
01:07:21 If we go back to the graph in our character, we can go ahead and close that
01:07:30I'll select this, press C to add a comment, and do health bar stuff
01:07:38Okay, and we can move this around like so
01:07:46 One thing you might notice is that if we hit play and go on this once, when we get out, we're going to see it's actually still damaging us even if we're outside of the collision box
01:07:55So, we need to add our logic here to stop this timer, which is looping and applying damage over and over
01:08:03In order to do that, we need to drag off our other actor pass to the Third Person Character, and we need to stop this timer
01:08:13The way to stop it is to get a reference to our timer, so we can drag off the return value and promote that to a variable
01:08:25We can name this variable "TimerRef" for Timer Reference
01:08:28Then, we can drag our reference, get it, and use "Invalidate", "Clear Timer by Handle", and "Validate Timer" nodes
01:08:38Hook that up to the execution
01:08:40Basically, when we leave the collision box or the damage box, it will stop the timer and stop applying damage to our character
01:08:51So, we can test this out—damage, and we can walk out of here; you see, it stopped damaging our character
01:09:05Right, so let's actually add some particle effects
01:09:07Because, because, say we want to have a little fire on here so that instead of having this little ugly box, we can actually have a fire particle effect that looks nice and actually damages our character
01:09:22Open up your Epic Games Launcher, and on the Marketplace tab, here we can go ahead and search for FX
01:09:31Then, you want to filter by free
01:09:33You're going to see this FX Variety Pack, and of course, you can always search for FX Variety Pack in the search bar
01:09:44But once you click on it, here you want to go ahead and add this to your project or get it
01:09:51It's 100% free, so once you click add to project, we might have to close our project here first
01:09:56I'm not finding it here; I'll just restart my launcher real quick—exit the Epic Games Launcher, restart this, and then..
01:10:03Back in our FX Variety Pack, we can go ahead and add a project, show all projects, and search for "Blueprint Beginner." Select that, and you'll see here "Asset not compatible." We can go ahead and hit this dropdown and select the latest version that's closest to Unreal Engine 5, so we can choose 4.26, and click "Add a Project." This will add the effects we need here for a little damage actor to our Unreal Engine 5 project
01:10:33Then, you'll see here a new folder called FX Variety Pack, and we can go to Particles
01:10:40You can see we have all sorts of effects, so we actually want to use this Magic Circle, which is this little fire effect to damage our character
01:10:54So, we can go ahead and right-click, edit our Damage Box, and we're going to add an event again
01:11:02Spawn emitter at location, so this will spawn that particle effect, and with the location, we want to get the target location and hook up the vector into the location
01:11:19Now, all we need to do is go back, select our magic circle, and assign it in there
01:11:29Again, we can actually select and access our Content Browser within the Blueprint, which is a new feature of Unreal Engine 5
01:11:42But anyway, we can go ahead, compile, and hit Play
01:11:47You can see our fire effect; you can see it actually damaging our character
01:11:52 Another thing that I want to mention is that we can obviously select our damage box and set it to Hidden in Game
01:12:00Now, when we hit Play, we can see a little particle effect here damaging our character over time, of course
01:12:10We can move out
01:12:13So now let's go ahead and add a health or a healing actor that will heal our character's HP back to normal
01:12:22Back in our Content Blueprints, damage box, we'll go ahead and add another Blueprint class, Actor, BP_HealthBox
01:12:27Open that up
01:12:30In here, we'll go ahead and add the same thing—a collision box, box collision, name this Heal Box
01:12:37In our Event Graph, here we can go ahead and delete this and select our Heal Box, scroll down, add our OnComponentBeginOverlap and our OnComponentEndOverlap events
01:12:54Then, off the other actor, cast to ThirdPersonCharacter
01:12:57The same thing, we want to set a timer by event so we can loop healing our character
01:13:08Off the event, we'll go ahead and add a custom event named HealPlayer, and this is what we want to do for this
01:13:20The event is that we want to take our character reference and get the health, and you want to check and see if the health is equal to 100 HP
01:13:36Okay, so is our health variable equal to 100 HP? And if so, we return this boolean
01:13:42And if you remember, the boolean is true or false, so if we drag off our boolean, we can do a branch and hook that up to our "Heal Player." Before we can heal our character, we're going to check to see if our health is equal to 100
01:14:04If so, we don't want to heal our character because they're already at full HP
01:14:12But if not, what we want to do is get the health and add, say, 10 HP
01:14:19Then, we again drag off our character and set the health, hooking up the add to our health variable and connecting the false output into the health update
01:14:27We want to heal our player when they overlap; if they have less than 100, we want to heal our character by 10 HP, and of course, we need to set the time here, so we'll set this to every 1.5 seconds looping
01:14:57We want to heal our character by 10 HP, so go ahead and drag this box in here, scale this thing up, and we actually need to add our particle effect and all that good stuff
01:15:11So, do another Event Begin Play, spawn emitter at location for our emitter template; we can just search "Heal Aura," and then for our location, we can get the Actor Location and hook that up to the location like so
01:15:31I'll say that if we hit Play, we can now damage our character, and then we can start healing our character by standing in here
01:15:45You're going to see, if I walk out, it's still healing our..
01:15:48Character, because we forgot to add the "On End Overlap" event
01:15:57So again, what we want to do is stop this timer, and to do that, we want to get a reference to our timer
01:16:04We'll go ahead and drag off the return value, promote that to a variable, and name it "This Timer Ref." Then, off of our "End Overlap," passed to the Third Person character, we want to drag off of "This Timer Ref" and call "Clear and Invalidate Timer by Handle." Compile, save, and now everything should be working
01:16:28If we go into our damage, we can damage our character
01:16:31If we go into our heal, we can heal our character
01:16:37And if we step out, it's going to stop; stepping back in, it's going to start, just like so
01:16:48A very simple way to implement damaging and healing your character, as well as binding that event to your..
01:16:57User interface, so hopefully you've learned a little bit about communicating between blueprints
01:17:04Alright, so next up, let's go ahead and create a soccer goal and a soccer ball actor
01:17:08Go to your Blueprints folder again, right-click, and add a new folder
01:17:16We're going to name this folder "Soccer Blueprints," and inside it, we'll add a Blueprint Class of the type Actor
01:17:23We'll name this BP_SoccerGoal
01:17:26Go ahead and open this up, and in here, we'll add a Static Mesh component named "Soccer Goal." Compile and save that
01:17:35Back in our Content Browser and in the project files—remember to download the project files from the link in the description
01:17:48If you haven't already, import them by dragging and dropping into your project files
01:18:01I have this soccer goal right here, and right now you can see there's no material on this net
01:18:10So, let's go ahead and fix that real quick
01:18:13In our Content Browser, we have this Net material
01:18:17Double-click that, and in this material, we want to add this Texture Coordinate node, this mask, so we can go ahead and drag that into our net's material graph
01:18:25Change this net material type to Mask and connect the RGB output into the Opacity Mask
01:18:35This will give us this little mask for the net
01:18:38We can also select the net and make sure it's set to Two-Sided, so we can see from the back and the front
01:18:55Save that, and now our soccer goal has this net material
01:18:56Now, we can go back to our Soccer Goal blueprint with our Soccer Goal static mesh
01:19:00Change this to sm_soccer_goal
01:19:05All right, so right off the bat, it might look big, and what we can do is actually go to our Blueprints, Soccer Blueprints, Soccer Goal, and drag this into our scene
01:19:21What I'm going to do is actually delete all this third-person stuff to make room, and we can go ahead and move this, rotate it around so it's facing us
01:19:33You see, it's huge, so what we're going to do is with our Soccer Goal here, we're going to snap this window like so
01:19:45Go back to our third person, and we're going to adjust our scale right here to be something like 0.5, 0.5, 4.5
01:19:54That looks a lot better
01:19:56Now we can go ahead and compile, save that
01:19:59Now, let's go ahead and add another component, which is a Box Collision, so we can go ahead and scale
01:20:11This box collision should be inside of this goal, so go ahead and move this up to scale something like so
01:20:21Now, what we want to do is, with our box selected, scroll down, add an Event Begin Overlap, and right now, what we want to do is, when a ball overlaps with our box collision, we want to spawn an explosion or particle effect to show that we scored our ball in the goal
01:20:50 So, of course, we need to actually create the ball, so let's go ahead and go back to our Soccer blueprints folder, right-click, add another Blueprint Class of the type Actor
01:21:02You want to name this BP_SoccerBall
01:21:04Double-click and open it
01:21:06I'm going to add a Static Mesh Component, name this Ball Mesh
01:21:08In our Static Mesh, we can search for 'SM_'—under SM_SoccerBall, we see ..
01:21:12This little soccer ball, and of course, this one is also really big
01:21:24If we hit this combine, we can drag this into our scene, you see it's massive
01:21:32So, we'll go ahead and size this down by going in there, soccer ball 0.1.1.1, compile, save
01:21:40You see that it is a lot smaller and much better
01:21:46Maybe it's a little bit too big, but for this purpose, it'll be absolutely fine
01:21:51So now we have our ball blueprint, so we go back into the goal event graph
01:22:03We can go off of our other actor and cast to BP_SoccerBall
01:22:07So, if a ball has overlapped and entered into our goal, what we want to do is spawn emitters at location
01:22:16For our location, get our Soccer Goal and get its world location, and then we'll just plug this into our location
01:22:22We'll add maybe a little
01:22:28Explosion, maybe this little ply hit, compile, and save that
01:22:34And so, if we hit play here, you're going to notice one of two things: our ball does not move around
01:22:46So, to actually let our ball simulate physics and move around, we need to go back to our Soccer Ball, scroll down to the Physics tab with the mesh selected, and then you want to check this "Simulate Physics" box
01:23:06For our mass in kilograms, we want to set this to 20
01:23:10Compile, save that
01:23:13If we hit play here, you’ll see our actor moves
01:23:16We can hit it into our goal, and you see here, it’s not going inside of our goal
01:23:20This is because we also need to mess around with the collision settings on our Soccer Goal
01:23:30Go to your Soccer Goal blueprint, select your Soccer Goal mesh, and in this static mesh, we want to scroll
01:23:38Down to the collision, and under the collision complexity, we want to just use complex collision as simple
01:23:43Okay, now, if we save that, I'm going to go ahead and move this back a little bit, move this like so, and then if I hit play here, I can kick our ball into the goal, and you see it play that particle effect
01:24:01Now, I also want the ball to actually disappear when I do that, and I also want my particle effect to be much larger and more visible to the character
01:24:11So, back in the Soccer Goal Blueprint, first destroy our soccer ball after it's scored
01:24:18So, off of here, we can do 'Destroy Actor' after the target, being the 'BP_SoccerBall' hook that up, and then for the emitter location, we can Alt click there, and instead of doing this, we can drag off of here and do 'MakeVector'
01:24:36Vector, and then off of here, we can do a Break Vector node, hook up obviously the X and the Y, and for the Z, we can do this—like 300 units higher than the location of the goal
01:24:54That way, it just spawns a little bit higher
01:24:57If we hit Play, we can run it into our goal just like that
01:25:01 Now, the soccer ball actually isn't the smoothest when it's rolling around, and it needs better collision on the model
01:25:12So, if we go into our project files, select the soccer ball, go to our Collision settings, we can remove the current collision and add a Sphere Simplified Collision
01:25:25You see here, it's this little green line—you can't really see it—but if we hit Play now, it's going to roll around nicely and smoothly, just like that
01:25:36 So now, we can score a goal and see it explode
01:25:42Just like that, but right now we don't have our ball spawning back in, and so the game is pretty boring
01:25:50Here, we could only score once and the ball is gone
01:25:55So, to respawn the ball, it's actually really easy
01:25:58We go back into our Soccer Goal blueprint, and then, off our Destroyer actor, we're going to do an Add a Delay, and we're going to wait for about two seconds after they score
01:26:10Then, we're going to spawn actor from class
01:26:13The Spawn Actor from Class node spawns a blueprint or an actor
01:26:16In this case, we're going to search for our BP_SoccerBall or Soccer Ball
01:26:29For our spawn transform, what we actually want to do is right-click and split this, so that we have the vectors and rotator of our spawn transform location
01:26:38You want to drag off of here and promote this to a variable, and we can just name this "WallSpawnLocation," like so
01:26:51Compile and save that, and now we can set the ball spawn location default value here
01:26:59But instead of doing this, this would actually require me to look in the viewport, define the location, and copy and paste it back into here
01:27:12And if I actually wanted to move the ball around to a different spawn location, it's just not the best way
01:27:18 Alright, so what we want to do is create a new variable, and we're going to name this "SoccerBallRef." We're going to change the variable type to "BP_SoccerBall," which is an Object Reference, so we can actually have a reference to our soccer ball actor
01:27:34Now, what we can do is, off the Event Begin Play..
01:27:38We can get our soccer ball check to see if it is valid, so this is just double-checking to see if our soccer ball actually exists, and if it's not actually deleted
01:27:57If it is valid, we can get the ball's location and then set our ball spawn location like so
01:28:06Now, what we can do is set our soccer ball reference to be instance editable and exposed on spawn
01:28:14Checking those options allows us to do that
01:28:23So, if we head back over to our level, select our goal, you can see we have this soccer ball reference under the default settings
01:28:31What we can do is click this little selection icon here, and we can actually select our soccer ball actor
01:28:37That allows us to set a reference to the soccer ball in our..
01:28:44Scene, so now we can move our goal around
01:28:46Whatever we move our soccer ball around, wherever
01:28:49First, remove it like that for now
01:28:51Hit play, and I can go ahead and run that into there
01:28:59You see, two seconds later, it spawns in the same exact position
01:29:02Let's see if I didn't like that position; I can move it over here, throw it in there
01:29:08It's going to update the position of where it spawns, so you can see here, by exposing variables, we can very easily select references and change them in real time
01:29:18That's the power of Blueprint—you can expose certain variables so that you can tweak things while you're messing around in the editor, without doing a lot of back and forth
01:29:35Alright, so that's pretty much our soccer Blueprint
01:29:38Right there, we spawn, and it spawns a little particle effect, respawns our little ball just like so
01:29:47All right, so we've created a simple door, a hat pickup, a little health bar, a soccer goal
01:29:53Lastly, let's go ahead and create something a little bit more advanced, like a little hit actor—something that you see in a Fall Guys game where you're running around the map and you have little spinny things that hit you and make your character ragdoll and all that stuff
01:30:17So, let's go ahead and make that real quick
01:30:18I'm going to go ahead and close all of these blueprints that I have open, and in our Content Browser, we can add a new folder called Hit Actor Blueprint
01:30:27In here, we can add a new Blueprint class, of the type Actor, and name this BP_Hit
01:30:31After, so we can go ahead and double click this to open it up
01:30:36What we can go ahead and do is first add a static mesh and name this Hit Actor Mesh
01:30:47You want to use the project files that I have included, the SM_Hit_Actor, so we can search for StaticMesh_Hit_Actor like so
01:30:55Basically, this thing is going to rotate around repeatedly, and when it hits the player, it's going to make our player ragdoll
01:31:06 We also need to add a capsule collision around this little hit part, so we can go ahead and rotate this 90 degrees on the X axis and scale it up, then move it up like so, just around like that
01:31:28I actually need to scale this a little larger and a little less, like so
01:31:35 Then, two more things: you need to add an arrow, and so we'll go ahead and move it
01:31:39This arrow like so, and rotate it 90 degrees, position it right in front of this, and the arrow will help us determine which way is forward for this little hit actor
01:31:54And then, lastly, we're going to add a rotating movement component, so the rotating movement component will automatically rotate our actor around and around
01:32:06So, if we compile and save this, we can actually drag this into our game here and hit play, and you can see it's automatically rotating right off the bat
01:32:24Now, what we want to do is add an event for when this object hits us
01:32:32We want it to ragdoll our character and send our character flying
01:32:35So, we can go ahead and go into our hit actor here, and in our event graph, we're going to delete all this
01:32:47Select our capsule, scroll..
01:32:48Down, and we're going to add an Event on Begin Overlap for the capsule
01:32:51We're going to cast to the third-person character, and what we want to do is call an event in the character that will handle our "Hit Actor" event
01:33:03So, go to your character, select your character, and edit the blueprint
01:33:07We're going to add a new event; right-click and select "Add Custom Event." I'm going to name this "Hit By HitActor." This event is going to have one input, which is a variable; we're going to change this to a Vector, and I'll name it "Hit Location." Now, go back to our BP_HitActor, and now we should be able to call it "Hit By HitActor." We want to get our arrow
01:33:41For that, we want to get the forward vector of our arrow and connect it into our variable like so, and we're..
01:33:53Getting this warning because we actually need to compile our Third Person Character BP first, before we call the "Hit By Hit Actor" function like that
01:34:02Once we do that, we can hook it up, compile it, and we're not getting any errors
01:34:12So, now back in our Third Person Character, we need to add all the logic for getting hit by the hit actor
01:34:20The first thing we need to do is, when we get hit by it, we need to set the "Simulate Physics" on the mesh, so we need to simulate our character ragdolling
01:34:31Then, we're going to add an impulse
01:34:33Here, we're going to do "Add Impulse." The target is going to be our character's mesh, and for the impulse location vector, we're going to create a vector based on the hit actor, do a "Break Vector," and hook up the break
01:34:51Vector into the Make Vector node, and then for the Z, we want to put a really large number, 50,000
01:35:06Actually, off of here, we want to multiply this, and then we'll right-click and select Convert Pin to Float
01:35:18You want to name this "5000," like so
01:35:21Right now, we can go ahead and test this out by going over here, and we see our character goes flying in the air
01:35:35What we actually need to do is set our character mesh, scroll down to Collision, and set the Collision Presets to Ragdoll
01:35:42Compile and save that
01:35:49Back in here, we're going to hit Play
01:35:56If we get hit, now you see it's a little bit more realistic
01:36:02But as you can see here, it’s still hitting our actual CapsuleComponent, which is sending..
01:36:11Our character is flying in the air repeatedly
01:36:19You also see here that we still have a capsule component, which you can walk around, and there's a lot of stuff that is wrong, so let's go ahead and fix all that
01:36:31When our character is hit, we actually don't want them to be able to move around
01:36:45We'll go ahead and get the Character Movement component, set its "Stable Movement" to prevent movement, then add a delay for about five seconds so they can't move during that time
01:36:51After five seconds, we can set "Simulate Physics" to true
01:36:56We can change this back to "Do Not Simulate." You'll see this little node here looks really annoying; it's not all straightened out
01:37:02You can actually add reroute nodes by double-clicking and then double
01:37:07Click again, just like so, so it's a little bit more neat, and then off of here, we want to attach the component to the component
01:37:20We want to attach our mesh, our character mesh, back to our capsule component so that our character gets reattached to our capsule component—the one that we control and move around
01:37:35I want to keep this to snap, the target, snap the target, and keep relative scale
01:37:46Drag off of the mesh, set relative location
01:37:58Relative location will be 0, 0, and then -95
01:38:09The reason why we're doing this is because if we were to just attach our mesh back to our component after ragdolling it, it would be in a weird rotation and all that stuff, so we need to reset the rotation to what it is in the viewport
01:38:21If you select the viewport, you see here our..
01:38:24Rotation, that's exactly what we're doing here, and then off of the mesh, we want to do Set Relative Rotation as well, hook that up and set the Z to negative 90
01:38:32Last but not least, we need to let the character move around, so we'll do Get Character Movement and Set Movement Mode to Walking
01:38:41That will basically undo everything that happens here, so we're setting the physics, adding an impulse so they go flying, stopping the movement, waiting for five seconds, and then we're undoing all that by Unsimming Physics, attaching the mesh back to our component, setting its location and rotation back to normal, and then allowing the character to move around freely
01:39:16So now, if we compile and save, I'm going to go ahead and move this soccer stuff out of..
01:39:25The way and move this like so, hit play, we can run into the area and see our character fly
01:39:34You can see we're still getting hit by this mesh, but we can't move around though
01:39:40So, let's go ahead and fix that real quick
01:39:42What exactly is happening is our capsule collision is still there, and it's still hitting it over and over, which keeps adding an impulse and sending our character flying a little bit
01:39:56Instead of doing that, we can add a new variable, a boolean, called "IsKnockedOut"
01:40:04Before we do everything here, and again, I’m just going to select everything and move it over
01:40:10Before we hit our character, we want to check and see the value of "IsKnockedOut," perform a branch, and check if our..
01:40:18The character is knocked out because, if it is knocked out, then we don't want to do anything, since it's already waiting on the ground
01:40:33If not, we want to set the variable to "is knocked out," and then, at the very end, we want to set our variable back to normal so that they aren't knocked out anymore
01:40:45 Another thing is, back in the Hit Actor, I want to go to the Hit Actor's mesh, and under the collision settings here, I want to set it to "Custom" and let the camera ignore the camera
01:41:01That's again for the Hit Actor's mesh collision settings—set to "Custom," with the camera ignored
01:41:09That way, we don't have that collision affecting our camera
01:41:11 Look at that—it only does it once and doesn't collide with our camera
01:41:19When we respawn, we can run hits on our character like that
01:41:26So, that's cool
01:41:28And all, but let's go ahead and actually adjust the value for how much it hits our character
01:41:35So, let's change this to something like 50,000
01:41:42Now, when we do this add impulse, we should send our character flying a lot more
01:41:47There we go
01:41:51So, now we can respawn here if we run into this
01:41:55Let's send our character flying in the air, then respawn
01:41:59Okay, so let's say you wanted to add actually more of these hit actors by just alt-dragging them out like so
01:42:11If we hit play, they're all spinning in the same direction
01:42:18Let's say we want them to spin in different directions, so they're not all spinning with the same rotation
01:42:28One way we could do that is if we go into our Hit Actor blueprint, in our rotating movement
01:42:40We see our rotation rate, and it's rotating 180 degrees on the Z-axis, and we can actually change that variable
01:42:48We don't want to change it here, but what we want to do is create a new variable and change this to the Vector type, then rename it to Rotation Rate and save it
01:43:00I want to make it instance editable, exposed on spawn, and in our Event Begin Play
01:43:10In our event graph, we'll add an Event Begin Play, and what we'll do is get our rotating object, set the rotation rate, and it looks like we actually need to change this variable from a Vector to a Rotator type variable
01:43:27So we can click to change the variable type, then compile and save that
01:43:34Get our Rotator Rate and set that in, like so
01:43:35This will allow us to change this Rotator movement value to this
01:43:44Value that we set, and what we set it and expose it on spawn, so let's go ahead and give this a default value of 180 on the Z-axis
01:43:53That way, it just has a default spin
01:44:01So now, if we go into our editor, we can actually select these, and you can see we have this node for rotation rate
01:44:09So we can do something like negative 180, and then maybe -140
01:44:11Let's save that and play
01:44:15You can see these are rotating at different rates, and we can actually even change this more
01:44:22For example, if we do -50, 100, they're going to be rotating at all different rates
01:44:27Actually, you can see that's a little bit too slow for us, so we'll go ahead and set this back to -180 again
01:44:40I want it to be around 80, like so, and so they're all rotating at different lengths
01:44:49It makes it a little bit..
01:44:53It's trickier to run in, and we can define these variables in our viewport and in our scene instead of duplicating our actor multiple times to have different values
01:45:05We can just use the Power Blueprint to expose a variable and have it be different for each actor in our scene
01:45:10One more fix: also, if you equip your hat and get hit by an actor, you're going to notice you start bugging out
01:45:21That's because the collision on our hat mesh needs to actually be set to nothing
01:45:26So, if you go underneath the Third Person Character hat mesh, we want to set the collision from Block All to No Collision
01:45:35Now, if we hit Play, we can equip our hat and get hit by an actor, and it will look all normal, like usual
01:45:45Alright, so that's pretty much going to be a..
01:45:48For this video, we've learned how to create a simple open and close door, a hat pickup, adding damage to our character, creating a health bar, and healing our character
01:46:00We also made a little soccer goal blueprint that respawns the soccer ball, and a hit actor that hits our character and stimulates physics
01:46:08I hope you guys learned a lot in this beginner Blueprint tutorial
01:46:19I'm going to make another tutorial following this one called Blueprint Intermediate, and then another called Blueprint Advanced
01:46:27In the intermediate, we'll cover more common things you can create in Blueprint, and in the advanced, we'll take things a bit further and discuss some more complex topics
01:46:35Advanced topics in Blueprint
01:46:44So, anyway, guys, if you enjoyed the video, make sure you hit the like button and the subscribe button
01:46:52I put a lot of effort into these tutorials and videos, and you guys do not want to miss out on any future tutorials
01:47:00So, anyway, that's it for this video
01:47:03Hope you guys enjoyed, and I'll see you in the next one.