Crouch - Motion Matching Move Set | Ask a Dev Quickplay Challenge Unreal Engine Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right everybody welcome back to another Asad Dev quickplay challenge my name is Kevin today's challenge is all about motion matching and additional movement sets so with our recent motion matching release we've been getting a lot of questions about what about crouches what about wall climbs and I'm generally like oh you should just be able to just throw it in right no problem it should be pretty straightforward but is it and so I figured we would do a quick challenge uh as a quick reminder these are unrehearsed unscripted uh full-on fumbling forwards as best as possible and what we're going to do is we're going to try to add Crouch to our motion matching tutorial that we did just recently so that's the goal my name's Kevin uh support the channel uh lots of ways to do it patreon all the links and stuff are down below tips uh spreading the word is awesome let's not Bel laborless and let's just get going so here we are Unreal Engine we have this is our motion matching tutorial it is in it should be in the state we were in when we finished our tutorial last time so let's just take a quick look at our um blueprint for our animations now what we want to do is we want So currently we are set on the Chooser method now in my mind I actually think the Chooser is going to be the easiest one but before we can even start to use the Chooser we do need to set up our character for crouching because currently we cannot Crouch if we press play we have no way to activate Crouch so we do need to do that so let's uh do that first so in our blueprints for third person uh what we want to do H we need a input action actually so we're going to put in input action here for crouching much like jump so if we go to input actions and we take jump I'm going to duplicate this and I'm going to call this one Crouch Crouch and I want to change I want to make one change to this which is this by default has both pressed and released I don't want that I'm just going to do pressed and then we can go back let's save that let's go back to our character let's Implement Crouch input action Crouch here we go okay and all we want to do is when we Crouch is we want to basically when we trigger Crouch we want to basically toggle it so uh the way we do that is I believe we can get that from our character movement cuz we do not have it divined here already and let's see what we have Crouch is crouching that will totally work for us so if we're crouching we are going to set it to not crouching so and we're also going to crouch or uncrouch now also interesting enough on our movement set if we type in Crouch because uh the movement component comes with this let's see here character move h no no it's actually not the movement set it's actually just part of the character Crouch so you'll notice under character we can crouch crouch and uncrouch O can Crouch that's something that we want to keep in the back of our minds and then we also need uncrouch as part of our toggle all right now if we are crouching let so we're going to need a Boolean in here if we are crouching we are going to uncrouch when we press the button and if we're not crouching we're going to crouch and that should do it that should basically set it up for us to be able to crouch now the problem is there's a bunch of there's a bunch of things here first let's um let's just put a Quick Print string in here so we know so this is going to be stop Crouch and then uh we're going fast here so we're not worried about typos and we're going to call this one Crouch okay so now when we do that we have our input action it's set up to toggle we think I think that's everything we need uh oh yeah we didn't actually connect it to our input binding so over here in our input defaults we do need to add the Crouch here it is I'm going to put this on the control key the left control key let's save that and play so now when we press control you can see it says Crouch and we press control again it still says Crouch interestingly enough I would expect it to uncrouch oh I think I know what it is so here's the problem remember what I was saying when I noticed that there's this is crouching and can Crouch I think I vaguely remember on our movement component we do need yes okay this it's always a check box it's always a check box okay so we do need the check this can Crouch this character can Crouch so let's go ahead and now that we can Crouch there so we're crouching and we stop crouching crouching stop crouching okay so it's working however we're not getting in any of our animations that's because we haven't defined them yet and this is where the Chooser and um this is where the Chooser and the motion matching stuff comes in the M motion matching database comes in so let's take a look at in our tutorial folder what I'm going to do is I'm going to create a new batch let's call this one PSD Manny Crouch so we need a new POS database set if you if you didn't follow our motion matching tutorial this is going to feel like we're uh uh it's going to feel like we skipped a whole lot of steps so I I'll put a link in here but go check out that tutorial so that you're up to speed because we're starting from there so let's do basically we don't even have any crouches in here that I see so we need to add them God I love clicking that button all right let's get all of our crouches from our characters heroes folder down here I'm going to get mm and Crouch so let's just grab them all for now and just drop them in and interestingly enough these do not have the motion on so we will go ahead and let's go find these real quick double click browse to crouch entry exit property M Matrix and we need to I'm just going to edit these using the property Matrix so we can do it all at once and we're going to do uh root enable root motion on these okay and let's just save them and go all right so now when we go back to our our Crouch database we should have what we need okay so we have what we need now one question that you might have is or at least I do is my suspicion is this won't work if we just drop all of our crouches inside of our post search database and try working because there's no way for it to know the difference between moving forward crouching versus moving forward standing up and and we could test that and maybe we'll do that do we can we do that fast actually we can do that really fast let's do that really fast let's go ahead and go to our all database and what we can do is we can just drop in the crouches just like we did before and we can actually test this right now so we'll go ahead and do that let's get all of these and then let's do a search on Crouch and let's make this a reasonable test so let's get rid of we don't need the turns cuz we're not doing anything for the turns walks are all good Idols exit entries let's just leave that and let's just see what this looks like when we connect it up so we're doing the all version of it so when we walk forward characters running and walking forward oh there's a little bit of a Crouch there now if we Crouch actually that's pretty good I'm pretty pretty impressed with that like that's the kitchen sink version now technically I'm no longer crouched here so it is crouching sometimes it's getting a little bit confused so this is why I want to be able to control now we might be able to do something like add in another trajectory node in our trajectory like our tracking node like right now we have our feet maybe we could add in our chest or whatever but anyways surprisingly enough that worked pretty well but let's go back to the Chooser method and what we're going to do is we're going to update our Chooser table so if you recall we have our Chooser table what we want to add in here is we want to add in another asset row and this one is going to be our Crouch table so Manny Crouch and I do want to make a couple changes in Manny Crouch just like we did before we don't need the turns for now and we keep all the walks let's keep all the entries let's just keep it straight straightforward let's save that let's go back to our Chooser table now in order to crouch this can be any should move could be any but we do need another column and the column we need is a Crouch column from our motion match database and I don't know that we have we do not have a Boolean variable yet so we do need to add a Boolean variable here to track our Crouch state so what I'm going to do is let's add a pen let's move this down let's get our movement component and rather than is falling let's get is crouching and what we'll do is we'll promote this to a variable and this is going to be Boolean is crouching and we will set that to whatever the state we're in so now we have a variable in our animation blueprint that also keeps track of this so that we can use that in our Chooser table so in our Chooser table we need to add a column it's a Boolean column and we need to add a binding and The Binding in this case is crouching so now we can explicitly separate this so we don't we want Crouch to be false when Manny's idle and false when Annie's running and true when Manny is um crouching so basically the only time Crouch should happen is when should move is anything and crouching is true and we're not going to get any of these others in the other states so that actually should do it and that's why I mentioned that I think this is going to be the easiest one so let's just see how that looks okay so our character runs everything is as it was before that's cool we can do all this stuff I don't see any weird things going on with our Crouch now if we Crouch cool characters down we're moving we're getting all of our post search database stuff just like I would expect that's cool and then we uncrouch and we don't have any of we're not we're helping it we're helping the motion matching system it doesn't it doesn't get confused as easy and just like that y'all crouches there it's pretty cool and we're also we're also even getting the idols and everything that we need pretty well actually um we do still have a little bit going on with our our foot stuff interestingly enough this actually if you notice this actually is stopping a lot better than our than our running and I'm almost wondering if uh it's as simple thing of putting our feet our stops inside of our run might do it that is something that we would have to troubleshoot maybe with the runtime debugger and I or the re the rewind debugger we can do a separate video on that okay so that's two different methods uh and why we wanted to split that that was the database uh that was the Chooser thing so that was pretty that was pretty straightforward all we did was add the variables we needed to the Chooser table and it was kind of as straightforward as I thought it was going to be now this one I think is going to be a little trickier so that when I say trickier what I'm specifically talking about is in our motion matching one if we go to Method two where we were using this Mo uh motion match Locomotion this one's going to be trickier simply because we have to manage the state machine so there's probably a good way to set this up but just for the purposes of our speedrun we'll go with Crouch okay and basically we have Crouch and what I want to do is inside Crouch I'm basically going to C I'm going to copy this but I'm going to copy inside Crouch okay so inside Crouch we're going to fill in our Crouch database here let's compile and save that and then we just need to be a able to get to crouch so to get to crouch I think I'm going to use an alias because we can get to crouch from any of these basically either idle stop or run and just in case you had a bunch of them so let's add a state Alias let's say two Crouch okay and two Crouch the way we get here is if crouching is true pretty straightforward okay and then who can come in Crouch well we can get there from idle stop and we can get there from run so we can go from run or stop that seems right and then we need a way to get out of Crouch so to get out of Crouch we basically want to update our Idol so this is should not move that's to idle okay but we also need to add an additional condition in here now I think because we don't want it to come out when it stops because of in it in the Crouch state so let's add we also want this to be not crouching not crouching the new uh stuff in 5.4 the little helper stuff is very very aggressive okay so now we can transition I to idle whenever we're not moving and we're not crouching we can condition we can transition to crouch whenever we are crouching that's true now there's one more if we're crouching moving and we stand up we should probably add in a two run as well so let's let's let's add it no yeah this is going to be an alias two run and this Alias you can get there from Crouch I think oh we want to make sure our two idle we can get there from Crouch as well so two run let's go two run and the condition for this kind of don't like this I could just drag off the Crouch straight to the run all right we'll we'll we'll keep this okay the condition for this is because we're only using it for the Crouch it's the same thing as me dragging the pen don't get lost with that I just want to take this and we'll go with a knot so we're not crouching and also should move should move is true so we need both of these and should move okay so there's a lot more going on logic wise with this method so let's see let's see if this is going to work so we should be able to get to crouch and we should be able to get out of Crouch and idle stop to run should just just be normal and run to idle should be normal I think that should do it let's see compile and save uh let's double check our anom graph we are using the motion match Locomotion let's see we'll know because when we walk uh especially left to right character stops on a dime which is good okay so it looks like we haven't broken our normal uh walk run stuff which is good now we just need to test our Crouch by pressing the control key okay looks good it looks pretty good okay so now here's the thing when we're stopped if I press control does do they come out of it yes they do that's pretty good now if I'm crouching and I'm moving and I press control do they stand up they do okay we did it that's it so like I said super fast um that's the whole point of these quick play challenges not to belor something just to take a quick little challenge can we actually do it very quickly or not not me necessarily quickly it's like can we stumble through it uh and figure it out together but I thought that this was very uh timely based on the motion matching video and everybody's questions about different movement types and stuff but you can basically see all you need to do is you need to set up a state that you can use and you can choose how you use that state are you going to use it with the Chooser and and create basically your own individual States or are you going to use it with a more traditional State machine overall point is make sure you check the box that the character can Crouch uh create your state variable and then make sure you balance it out correctly and at some point in the future we will do a video on the uh animation rewind debugger which is actually really cool and wild to look at to see if we can figure out what's going on with our Chooser feet placement stuff so as always thanks for checking out the video thanks for being the best part of this whole thing which is the community appreciate everybody's support we will see you on the next one take it easy
Info
Channel: Ask A Dev
Views: 1,594
Rating: undefined out of 5
Keywords:
Id: Kt34FduXp_4
Channel Id: undefined
Length: 18min 35sec (1115 seconds)
Published: Fri May 17 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.