How to Make a 3D Health Bar for your Enemy in Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys welcome to new unbrew engine factorial today I'm going to show you how to make a 3D health bar that will be on top of your enemies AIS characters whatever you want it's gonna be a very easy way to follow so let's get started alright so the first thing I want to do is quickly go ahead and create my ai's talents there so I can demonstrate this of course if you already have your AI or enemy you can use it one so I'm gonna go ahead and just right click create a blueprint class and character and this will be PP and an enemy toot animated for example let's go ahead and just open this up so first of all I'm gonna is quickly go ahead and place a character for example a queen simple there we go and just put it into place there we go and just go ahead and put the end in class to be on a queen so have some Idol animations there you go great so what we're going to do right now is go into bin graph and I'm going to create a Health Battle now I do have a you know Health tutorial so if you want to go ahead and check that out and check it out but for me in this store I'm not going to go ahead and create a Whole Health System okay this is just the helper on top so I'm gonna just quickly create a health value that will be for example yeah 70 right 70 out of 100 it will be for now so we just control this by this variable okay just do make the example okay so now what we need is a widget so I'm going to use interface widget blueprint use a widget and WB unscore health bar let's go ahead and open this up and then we're gonna go ahead and add a canvas panel into it uh now what we need now is the progress bar so let's go ahead and drag it let's put it in the center and put the position X and Y to be 0 0 and then in the alignment put this to be 1.5 and 25s will be perfectly in the center let's go ahead and make this a bit bigger maybe like this will work so and again we need to put the position X at zero because well we moved I'm gonna change the color into the red of course as always all the help bars in both in games and then the percentage for example 0.7 so we'll go from zero to one so we'll have to make an adjustment later on we'll bind the value but you get it yeah right so uh this will be you know 70 of Health right now I'm gonna make it a three bit you know thinner so it's a bit cooler there we go something like that I'm not gonna go into UI but um you know UI Perfect Design but you get the idea alright so there are many ways that we can pass our current help from the enemy and to here we can go ahead and create a binding but things that if we do that and when we try to cast into our enemy tooth and we are are not controlling it and and then we have to use it by the get owner node and stuff it will not work it's simply no work so what we can do instead is go and change this to be an appropriate name for example the health bar um just the health bar and then make sure that this variable in here is detect so now from that what we can do is go here and of course add the widget so let's go up here add a widget it will be a normal widget and this will be our health bar widget when you scroll like that and then we can put the widget class in here so this would be basically the one that we have created which is WB health bar and you will see on here now it's very big let's go ahead and make it like that and then make it smaller like so there we go put it here so we can do is just go into the event graph and and delete all this except for the ventic so with that we can just go ahead and get the health bar widget we can now go and get the widget itself okay now we can go ahead and cast to the uh help bar wizard there we go and now we can access that variable so get the bar health bar and then we can do is set the percentage so it's basically the variable that I basically show you before so this again will go from zero to one so we need to do is get our current health and divided by our Max Health which in this case I said that it will go from 0 to 100 so I will place it to 100 of course so you have a different one you can even plug here a Max Health one and with that said it will go ahead and work so if I drag in my enemy toot and rotate it so it's facing us for example you can go here and you can already see the health bar there but you can see here and it will be binded so if I were to go into the character here and selected we go I can go now down well I need to Showcase it sorry I need to bind it so quickly let me go into the enemy tooth and just open this eyes so we'll be public this will mean that I can just go from here selected and then be able to change so for example if you put it to 20 you can see that now it's at 20 of Health if I put it to 100 which will help it was a zero it will be zero if I put it to 50 it will be half of it so you get the idea now the problem right now is that if we turn you can see that the you know the helper is not following it so there's many options that we have uh we can also close the health bar already now the an option will be to go here and set it to be a screen so we compile and save you will see that it will now always be like not basically in a world position but always in there but I think that this might not be the best option because first of all it will always go and render on top of everything and then also if we go very very far away uh the health bar will not change the basically the size so instead what I will do is go and set it back to world and I'll go in the van graph and what I would do right in the band take two right after we set the percent it's got the health bar widget set the world rotation and then make this node which we'll just find look if I know how to type find look at rotation so here we can do is just find the rotation between two points in this case it will be this uh get wild rotation sorry location from our a hellbar widget and then from the camera so we're going to use this node which is the get camera manager and this will just find the camera in the in the from the player and then we can get the world location once again from the transform component and plug it in Target now you will see the now press play it will always be there and it's in a 3D space and uh besides formula change and there we go so you can customize this as you want and again I can change the value and it will update from the health department of the enemy so with that said guys if you found it so helpful I will show you like the video and subscribe to my channel I have lots of Unreal Engine factorials so go ahead and take them out join my description server and now you just said bye bye thank you [Music]
Info
Channel: Gorka Games
Views: 29,136
Rating: undefined out of 5
Keywords: games, videojuegos, unreal engine, unreal engine 5, ue5, 3d health bar, tutorial, quixel, megascans, unreal engine health bar 3d, enemy health bar tutorial ue5, ue5 health bar widget tutorial, ue5 head health bar tutorial, how to make world health bar in unreal, unreal engine 5 how to make progress bar
Id: PiPq3q1CXyM
Channel Id: undefined
Length: 6min 43sec (403 seconds)
Published: Thu Apr 27 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.