UE4 - Wall Climbing Tutorial - Part 1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right so i'm making this video for people that want to implement wall climbing system in their game uh for the last week i've been looking at a video of middle design in crocoped those tutorials are good but very good but i think we can do things a bit much simpler so what we're going to focus here and we're going to go straight in character blueprint and look at the logic that we need to build a climbing system so we're not going to use the interface blueprint and we're not going to use any function or any macros we're going to keep it very simple so i'm going to show you the bit of the final result okay all right so we're gonna jump straight ahead into uh a new third person third person template and we're gonna grab a static mesh over here and and that is gonna be used for the wall that we want to climb on so what i did is i did one already over here that that is the right size and everything so with this we also want to go to project setting go to trace the new trace channel and we're going to call this one ledge trace and set it to ignore perfect so on this wall that we have we want to it under collagen want to hit generate overlap event and also on custom yeah we want to save yes we want to get ledge trace and we want to block let's trace perfect so let's go and the third person character blueprint and let's create the first custom event and this first custom event is going to be our forward tracer or our wall tracer that we'll start doing wall detection over here with uh we're gonna have a forward tracer and a height vector uh eye tracer so we can get the height of the wall that we want to climb on so i'm gonna go and do sphere trace by channel and over here for the start point you want to get actor uh location and for the end point you want to get actor rotation get like the rotation get forward vector and what you're going to do is split the structure pin and over here make vector make sure that it goes in the z value and for those two one we're gonna make multiply by float multiply by float and the float is gonna be about 150 in front of us so it's going to extend from 150 unreal uh unit in front of us so we're going to make plus plus both vector and plug it in the end the trace channel is going to be ledge trace and draw a debug type for one frame so this is going to draw a debug sphere so we're going to see where we hit the wall if we have collision also if you want to turn it off after tutorial just put it to none easy as that an actor to ignore gonna make array and ignore ourselves on this we're gonna branch if we hit something and we're gonna take the out result from break it result expand and we're gonna do two variable location promoter variable this is gonna be wall location perfect and also we're going to need impact normal and this is going to be wall normal wow normal perfect all right so go ahead and comment this out forward tracer and four for our eye tracer it's gonna be a very similar process so we're just gonna go and copy those nuts and create a new custom event custom event which is going to be i tracer all right so for a start point over here we want to get actor location again go ahead and split structure by pin make vector yes x and y go straight i'm gonna push it so we have a bit more space i'm going to do minus and i'm sorry this is going to be plus let's say 120 we want to reach a wall that is 120 unit higher let's do uh plus a vector over here and also get actor rotation and get forward vector get forward vector yeah they're going to multiply by a float also let's say 40 for now this how far we're gonna check for wall over here this is gonna be a start point and for the end point we're gonna break your vector uh from x make vector and the z value is gonna be minus float it's gonna be a down 120 also so this is going to go into end and over here actor to ignore we can make array and ignore ourselves uh let's trace perfect for one frame perfect and what we want to get over here is location and this one is going to be height location so when we finish this we we also want to branch to see if the location is at the right spot in front of the character so what i'm going to do i'm going to compile over here and i'm going to go into the mannequin animation blueprint i'm gonna go into skeleton uh to pelvis add a socket uh okay i've already create the socket so it's okay we're going to use this one so pelvis socket and copy paste pelvis socket go back to third person blueprint we're gonna get yeah get the mesh over here and get the socket location copy paste uh split the stricture pin and from the z-axis you want to make minus float and get the eight location break the vector yes break vector and get the z and if this is in range of let's say minus 50 and zero we can branch and go ahead and do the other stuff so perfect so we can go comment this out hey tracer perfect so we want to enable this tracer at any point in the game to do wall detection so we're going to go to event tick and call both of those functions so forward tracer and i tracer perfect so let's go ahead and compile and i think we forgot something yeah we forgot we need to put a radius to the sphere trace by channel like radius of 20 uh it's gonna be fine for both so when we compile and hit play you're gonna see that we have both tracer if we go ahead and go to the wall it is eating the wall so it it is tracing on the wall perfect so from that what we can do so we go and go and create another custom event this one is going to be for grab grabbing ledge to grab the ledge and we're going to make a variable over here uh which is is jumping oops is jumping and we're gonna branch of on his jumping all right so when we want to grab the ledge we're going to set movement mode to flying because we're in air and we wanted to fly uh we're gonna go and make another boolean with this one is gonna be hanging so hanging on the wall when we're grabbing the ledge set is going to be set to true perfect and after that we can do our move component move component 2 and again from target relative uh we want to get a position we want to move to we're going to use everything we have here so get wall normal get wall location and get height location so just make space and over here i make multiply by vector let's put 22 for now 22 effect and every one of these just break vector so copy paste break vector and break vector perfect over here plus float we're going to add the x component and the y component perfect on the z axis over here minus minus float this one is going to be -120 and we also make a new vector it's going to be x y and z so we can return this value into target location perfect and for target relative rotation we're going to take the wall normal get the one normal and get rotation from x vector yeah split the structure from x make vector all right and it's gonna be minus float so we wanted the player facing the wall so it's gonna be minus 180 degree perfect uh sorry over here make rotator otherwise we don't have problem converting perfect and over time we can do this over time a bit shorter maybe 0.13 perfect and once we finish this we can stop movement immediately of the player okay so go ahead and comment this out grab the ledge oops this is the our event for grab the edge so when we grab the ledge we want to find a spot over here that we can grab ledge so what i'm going to do is an eye tracer that we're calling on even thick we're gonna go and gonna branch again and after we branch on a certain condition we're gonna go and call grab ledge we're just going to place a new variable new boolean which is going to be is climbing oops here's climbing ledge and for now this is just going to be a placeholder we're not going to use it but it's going to be set to false because later on we will want to move on the ledge climb on the ledge and jump all that good stuff so i'm gonna go ahead and leave this right like this compile all right so over here to the move to component make sure you got move to the caps with the capsule component so we're moving the capsule so go ahead and compile hit play and yes now we should be moving to the place that we want to play the animation so at this point we're going to play the hanging animation and it's gonna look like we're hanging on the wall so for this i'm gonna use the animation um that that uh metal design and cocopeat are using in their tutorial i don't know if i can link it to you because uh maybe they're copyright or something so if you want them just go ahead and go in the description of the video and download them so the first file you download is going to be a hang animation so make sure that you hit enable root motion save and for this uh what we want to do is go into the animation blueprint and make a new state over here which is going to be hanging hanging stick you want to go from jump start and we also want to go from jump loop so if we're in air we're going to be inking uh go ahead and make a new variable over here let's say two hanging two hanging animation and to do this yeah i'm gonna have error to do this you want to go in third person character and to the grab ledge event over here when we branch we want to cast cast to animation yeah third person animation blueprint over here get anime instance perfect and set to hanging set to hanging to true so we can play the animation set it to true perfect so we're just gonna place two hanging if two hanging is true we want to do the animation where we want to go so we want to go from jump start to hanging and from jump loot to hanging if two hanging is true and the third person blueprint and if it's false if it's not we can go back and finish the jump sequence and go back on the ground perfect so in the hanging state we're gonna drop the end animation over here make sure you keep the loop animation compile and perfect so we're gonna go and try this out so when i jump now i got the hanging i got a bit of an issue if i move i can still move around so we're gonna fix it right now we're gonna branch over here and the movement this is like just the basic input that we didn't create we use the third person template so over here if is hanging i'm gonna go and if it's true that we're hanging we're not gonna do anything if it's false we're gonna do the the stuff that we always do which is move around perfect so another branch perfect so now we're gonna stop the input stop the player from moving perfect so we go and we're perfectly on the ledge okay so i'm going to continue over here and what we want to move because we want to move forward with the system so one what we want to do next is another custom event which is going to be exit ledge and when we exit ledge we want set movement mode set movement mode back to walk in and cast to animation blueprint again again copy paste get admin stance and plug it into object gonna set to hanging set to again it's gonna be set to false also is jumping it can be set to false um so what we can do is on let's say on left shift the player can stop can stop the grab we're gonna branch if if is jumping is true call the function exit ledge so call this function that we just made so go ahead and comment this out exit ledge okay two two mistake that we made so over here we're not gonna go with is jumping gonna go with is hanging so if he is hanging uh we can exit ledge and over here also if he is hanging we gonna set hanging to false perfect so we're gonna go with compile and try this out and when perfect and we can move again effect can hit left shift and go back so the next step we want to do is that we want to move on the ledge this is going to be again this is going to be a bit of the same process because we're going to use tracer so i'm going to move it over here for grabbing and for the tracer i'm going to keep it on the side so what we can do is go to the viewport create two arrow this one is going to be left arrow and duplicate the other one is going to be right arrow right arrow and the location of both arrow is going to be 40 minus 60 and 40 for the left and for the right this can be 40 60 and 40. perfect so hit compile and over here i'm going to create two custom events uh which is gonna be left tracer and also another one just gonna be right tracer right tracer compile so we don't get warning and we capsule trace trace by channel we're gonna grab our left arrow and get world location and return the value and the start in the end for the radius we want about 20 and half i want 60 trace visibility ledge trace and draw debug for one frame actor to ignore again make array ignore ourselves and for this we're going to make two variable we're going to be can move can move left yes can move left set and also can move right so we already have this oops so we're going to branch a branch if we're hitting something can move left is true if we're not can move left if false go ahead and just copy paste this function that we just made for the right tracer and change the arrow for the right arrow and also this variable for can move right two can move right through can move right is false all right so on eventic uh we want to call those function so i'm just gonna comment them left and right tracer i'll even take what we can start to do is say if we're hanging so if it's true that we're hanging we're gonna check for both of these so right tracer and left tracer we can check for these uh so okay so hit compile and check what is happening perfect so when we're hanging we made two tracer at the left at the right so this we can use to uh move the location of the player character with another function so we're going to go and over here i'm going to create another custom event same event so we got a custom event move we want to branch on hanging so if ending is true we're gonna get over here we're gonna create another variable which is gonna be ledge direction or ledge move direction so make this float set it and we're gonna store the move right of our input so if we're moving right this is one and moving left is minus one so with this we can do logic to move the player between position so we also make wanna make two boolean boolean which is moving left duplicate and moving right perfect and if hanging is false we want to set both of these to false perfect hit compile and we're gonna do another custom event that we can call over here so we could do right here but it's gonna be a lot of a lot of stuff to get handle so we're going to go ahead and just create another custom event this one's going to be custom event move move on ledge oops at the beginning of move on edge we can do sequence add one pin and go here and give us some space [Music] and yeah a lot of space so the first thing we want to do the first thing over here is let's say if we're moving right okay so we go ahead and create two variable that is can move right and can move left so on sequence we're gonna branch with can move right for starting and if it's true we're gonna do another branch and we're gonna get the move right input i'm gonna check if it's greater than zero if it's greater than zero we can go and over here set actor sorry set actor location and new location will be we're going to interpolate between locations so i'm going to use v interp for delta time just get world delta seconds and over here for uh moving 2 i'm gonna use the get actor location and also get actor rotation click [Music] get right get right vector multiply by float and let's say 20 and make over here plus uh vector plus and break this one so basically we're adding ball vector can go and plug this get actor location and current and this and target so when we're doing this we're gonna set moving right set moving right to true and also moving left to false perfect [Music] so i'm gonna go and copy paste this and use this for the left side this is gonna be basically the same thing but we're gonna use can move left over here we're gonna check i'm gonna check if it's less than zero and over here you can go ahead and this is basically how fast you want to move on the ledge 20 is good with the animation so we're going to leave it like that and then at the end we're going to set moving right to false and set moving left to true and the last pin here we can go and branch again and get move right yes and check if it's equal to zero if it's equal to zero we're gonna go and set both of moving right and moving left to false perfect so it compiled uh comment this let's say move part two and this was our move part one and like i said we want to call this move interpolate somewhere so just go here and move on ledge so we're gonna plug this over here and we're gonna go into okay so if you want to get this to work we're gonna go to eventic over here just call [Music] the custom event move hit compile and we're gonna test it so when we jump in on the ledge now we can move on the ledge so it's a bit fast like we're moving very fast so what i'm gonna do is add enter speed over here we're going to use a value of 5 perfect test it again so now we're moving slowly so what we can do here is basically just play the animation like we did so go ahead go to the animation blueprint uh to the state machine and make two more state one is going to be move left and if we want also to go back and add a new state and call it move right and one also to go back okay so so for the animation we're gonna go and again we're gonna use the animation from uh tutorial from medal design so import those select your skeleton uh so now we have those are basic move left move right animation make sure you hit enable root motion on those enable motion effect and let's go back to our animation blueprint and on move right we're gonna place move right in animation make sure you have loop animation on the left move left okay so we're going to go back to the event graph and what we can do over here is we want to make a cast to the third person character blueprint so over here gonna start by doing cast and the object is gonna be this try get pawn owner over here and just make it look a bit better like this all right and so what we want to have over here is we want to create basically the same variable that we did in the third person character blueprint so we're gonna have moving right duplicate moving left another one is gonna be can move left and also can move right okay so what we can cast over here is those variable so we're gonna get the same get moving left get moving right we want to get get can move left and get get can move right all right perfect so for starter over here let's make some space again so we're gonna get also that direction that ledge move direction and we're going to make i'm going to make if it's less if it's less than zero and moving left is true we can set our our variable over here moving left we can set it to the to the value of this boolean so same thing over here and get ledge move direction if it's greater than zero and and moving right is true we can set can set moving right to the value and for the last two of those we're just gonna get the value and return it directly to those boolean so set and set can move left and can move right perfect so it compiled go back to the animation graph state machine okay so when we go back in the animation blueprint i'm gonna go ahead and check if we're moving right we're going to go and do can move left and moving left if both of these are true we can go ahead and play the animation and for the right i'm gonna go get and get if both of these are true you can go ahead and play the animation so what we want to do for going back to ending so when we're stopping i'm going to go over here let me see if both of them are not true but let's say if either one of them are not true so or you can stop playing the animation and just go back so take this and copy paste for left over here and just place the left variable get get it compiled so now this should be good but what we also want to check if if we're going to this state and if we can go back to this state so basically over here let's just say if two hanging is true and to go back so go back to idle to moving right if hanging is true only if hanging is true and if hanging is false you can go ahead and stop playing those animation so all right i'm gonna do the same thing for the move left over here now so let's take this up to here and let's get this one back to jump loop and let's make it clear so we can see yeah yeah we can see so this one if hanging is true and this one if hanging is not true so same thing over here if hanging is not true i think we forget to place the knot so what we're saying say go to those animation only if we're hanging and if we're not hanging go back here as you would do and finish the jump loop and go back to idler run so compile and let's try this perfect so now we have the animation set up so as we can see we're moving left right and where we at the end we're stopping because the condition that we put is that we're stopping perfect so what you can do real fast before i stop this tutorial is maybe play with this rate scale and make it a bit faster so we can move a bit better so it's safe let's try this again yeah it's better so we're going we're yeah we're moving on the ledge if we quit we're moving we're back and we're still moving okay so i'm gonna stop this part like that's gonna say part one over here because those are gonna be like i don't know maybe i hope it's not gonna be one hour video but uh maybe i'll split it so we'll see all right perfect so see you at part two
Info
Channel: Nitrous
Views: 1,342
Rating: undefined out of 5
Keywords: unreal engine, ue4, wall climbing, ledge, unreal, tutorial, uncharted, adventure, third person, wall, assassins creed
Id: 906yaWvSoQk
Channel Id: undefined
Length: 44min 56sec (2696 seconds)
Published: Fri Jan 15 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.