How To Have Random Idle Animations In Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys and welcome back to another Unreal Engine 5 tutorial so in today's video what we're going to be going over is how to create a random idle animation that will play for your character in your game so let me hit play and show you what gonna make today so as you can see we've got different random idle animations here animations don't look amazing really sorry for that it's just because these are just animations that I very quickly got off of miximo so some of the bones don't match perfectly which is why when I very quickly retargeted it it didn't look amazing so sorry about that but it's not really how they look that's not the problem because you probably won't be using these animations anyway because they don't all match that well I've just picked them just to show it working and we're going to be going over the functionality of the code today so we can have it working so when you're idle you're going to have a random idle animation so it's not going to look too repetitive so let me delete this code and I'll show you how I've done it so this is actually very very easy to do all I did was I imported my animations and then retargeted them over to the cracked skeleton and again I got my animations from mixmo.com then you're going to want to open up your animation blueprint so for me that's characters mannequins animations and then ABP Manny now once you're in here you're going to want to go to the anim graph and then open up the state machine for me it's Locomotion but for you it might be main states or whatever it is but we're going to open up the state machine and we want to go into our idle State here now if you don't have an idle State you just have idle walk and run all in the same one you're going to want to make sure that you do separate those so you can just create a new state and put your idle animation in there and then have it go from should move and should not move obviously into walk run if you don't have this already set up then I'm not going to go back in today's video I do have another video where I go over how to create this in more detail but if we open up our idle State we're going to delete any idle animation we already have in here and instead what we're going to use is something called a random sequence player in here we can input multiple animations and have those be the ones that will play randomly so let's add in our array elements here I've got five animations I want to use so I'm going to add in five elements here then we can open up these and add in the animation so I'm going to go to where they are for me which is Idle animations new and then I've got mine here so I'm going to use happy Idol first now there are many different things you can change in here for example the chance to play I like to just leave this one but if you have one main animation which you want to play the most so maybe you have one main Idol animation you can put this in here and maybe have a chance to play B2 instead of one I'm just going to leave them all the same for the purpose of the video then you can change the Min and Max Loop count so if you want this main animation to play not have more of a chance but just to play more you can have the minimum B2 the maximum B5 so that means this animation will play a minimum of two times and a maximum of five times before moving on to the next animation again I'm just going to leave these at zero and then you can also change the play rate as well so we can change this to two and five as well which means the minimum play speed will be twice the normal and the maximum will be five times or you can do this the other way you can go 0.2 and 0.5 so it's going to be 20 of the normal or 50 once again I'm just going to leave these as normal and then what we can also do is go down to blend in here and change the blend time now this you may want to actually focus a little bit more on with each animation you might be thinking oh well I just want them all to be the same I have the same amount all of that so I'll leave all the settings as default the blend in you might want to actually change as sometimes the blend transition might not be too smooth so you want to increase this time for example from 0.2 to 0.5 means it will take 0.5 seconds to blend between the different animations so it will take 0.5 seconds to blend into this animation so again if you've maybe got it to be quite a sharp transition increase this here and that will help smooth that out and look a lot better and then you can just do that for all of the animations which you have so you can just add them all in here change all of these values to what you want I'm just going to leave them all as default but I have gone over and cover them all so you know what they all mean and what they will do and the final thing on here is you can see we also have Shuffle mode here if we tick that this means it's going to play them in a completely random order whereas if it's not on shuffle it's just going to play them one by one like this so I like to have it be shuffled because otherwise it still looks repetitive the whole reason why I'm doing this is to make it not be a repetitive idle animation whereas if it's not shuffling it will still be repetitive just longer so now I want it to be Shuffle instead so it could go zero three one four two and then start again at one four zero two three for example so just go through them in a random shuffle order you also know what Shuffle means and that is all we need to do this will now allow us to have a random idle animation playing if I hit compile it it's just going to play a random one again really sorry that it looks absolutely terrible here this is just because of how quickly I've had to do it and the animations I'm using and the characters and the bones and the skeletons and all of that stuff but again we're not focusing on what this looks like physically we're just focusing on the functionality of it and how it works and you can see that this is going to work if I had to close this and hit play we're gonna have this animation playing so if I were to run around for a bit you can see that if I then stop we're going to play a different animation again it looks terrible I'm really sorry about that but if we to move about once again it's just going to keep changing every time we're in an idol animation and it also once it exit this animation it will enter a new one at random too as you can see perfectly there so I think that'll be it for this video as we've done everything we want to do what I've done is we've set up a random eyes animation so it's going to play different animations all the time in a shuffle mode and obviously the more you have the better it will look but you really don't need that many for it to look nice you could just use two just have a normal idle one and then one where it looks around and have it just play them differently so obviously you're going to play the main one a lot more and have a higher chance of it but the other one will still play every now and then as well so thanks so much for watching this video I hope you enjoyed it and hope found it helpful and if you did please do make sure to like And subscribe down below so thanks so much for watching and I'll see you in the next one [Music]
Info
Channel: Matt Aspland
Views: 13,719
Rating: undefined out of 5
Keywords: ue4, unreal engine 4, unreal engine, tutorial, ue4 tutorial, unreal engine 4 tutorial, how to make a game, how to, blender, unity, games design, ue5, unreal engine 5, unreal engine 5 tutorial, ue5 tutorial
Id: vDL-TuJGZMI
Channel Id: undefined
Length: 6min 35sec (395 seconds)
Published: Mon Sep 04 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.