How To Make A Slippery Surface In Unreal Engine 5 | Sliding On Ice (Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys and welcome back to another Unreal Engine 4 and 5 tutorial so in today's video what we're going to be going over is how to create a slippy surface inside of your games so if I were to hit play I'll show you what we're going to make today so as I'm walking on the grass this is a normal material this is perfectly fine so nothing will be different but as soon as we go on to this ice it's always slippy surface you see when I stop moving we're actually going to slide forwards and I'll just general controls it's gonna be really slippy and slidy like this now you can change this and customize it to have it however you want so more slippy less slippy more or less control anything along those lines and again as soon as I were to come off of this surface we're going to be back to normal so this will be going over and creating today so without further Ado laminate this code and I'll show you how I've done it so there are many different ways of doing this for example you could do it maybe through physical materials so if you wanted it to be based on each material you could do it that way however the way I'm going to be doing it is not through that it's going to be a more simple and more basic method of just using a simple box Collision as I think that's gonna be the most versatile for us so we can have it just in a general area rather than a specific material because maybe you want a material in two different areas want to be slippy one wooden because for example maybe you have wood they'll be slippery somewhere but not somewhere else anyway we don't need to go into that much detail we're just again going over the area so first things first what we need to do is create an actor for this so we're going to right click on a Content browser create a blueprint class and we're going to create an actor and I'm just going to name this one slippery surface BP does that make so much sense for me and I'll open it up straight away what we're going to do in here first is I'm going to create a plane so I'll add in a plane like so now the only reason I'm doing this is just so I can get a preview and more easily see what area I'm covering that's going to be slippy so I only want this to be in editor so first thing I'm going to do is search for hidden in game and tick that there so we're not gonna be able to see this in the game as again we don't want it like that so let's also actually disable the Collision so go to Collision presets and set it to note Collision so essentially this is not here in the game at all we can't see it and we can't collide with it it's simply there just for a visual representation of the area for us the developers while editing next we're going to deselect this and add in a box Collision like so and this is going to be where the player is going to be inside of to actually be on the slippy surface so we want this to be the exact same size or slightly bigger than this plane here because again the plane is a visual representation of where we're gonna be slipping the Box Collision is the actual area so to make this the right size we don't want to change the scale we want to change the Box extent now if you're just going to be doing what I'm doing and getting a plane at default size the Box extent You're Gonna Want Is 50 50 and 10 in so you'll see this is covering it perfectly and the reason why I've got 10 on the Zed is just to give us that a little bit of leeway so when we put this on top of another surface we do actually have that area above it that we're going to be able to collide with because again we want to make sure the player can Collide and enter this box so just giving it that little bit of room there just make sure the player's feet and the legs can definitely fit inside of this whereas if we left it at one you'll notice there's not much room there for them to actually be able to collide with it that's why we're setting it to 10. so a compile and save with that next we're going to go over to the construction script and set up a few things so what we're going to do is hit the variable here and we're going to name this one show plane question mark and we'll leave that as a Boolean and take the eyeball to make it instance editable so essentially this means we can toggle on and off the visibility of the plane in the editor so we can see a preview of what's underneath it as well so I'm going to drag this in get show plane and then also out of the construction script I'm simply going to just set visibility of the plane like so and we can just input new visibility into show plane so show plane is true we're going to show it the new visibility will be true if show plane is false then your visibility will be false so we'll compile and set the default value off show plane to be true then after this what we're going to do is we're going to want to scale it up and down so we're going to drag in a box dragging up the plane and then out of one of these we're going to set relative scale 3D collecting both of them into there like so then we'll just connect this into set visibility like so so we're going to be doing both of these on the construction script we will right click new skill 3D and split the structure pin leaving the new scale 3dz as one so we're not going to be changing the Z value at all then the X and Y wants to be another variable so we're going to hit the plus variable here naming this size we'll change this to one to be a float and again take the I so it's instance editable then we'll drag and drop this in like so connecting it into X and Y and if we compile it we can set the default value to one now if we go back to the viewport you should see this shouldn't look any different it should be the same if it doesn't look the same to you that means you've done something wrong so if you can't see it make sure show plane is true and also make sure size is one now if we go to the event graph we can delete these two nodes and start doing the code to actually make the player slip so to do this we're going to right click on the box Collision add event add-on component begin overlap right click on again add event add-on component end overlap because again when the player is in this box Collision they're slipping when they're not in the Box Collision they're normal so that's why we have begin and end overlap now we want to make sure this is done specifically for the player so out of other actor what we're going to do is cast to and then the name of our player so mine is BP third person character now if you have multiple players or you don't want to do it on a cast because you don't like the efficiency of it you can use blueprint interfaces instead which I'll leave a link in the description down below and on screen now to my video on blueprint interfaces which should help you out quite a lot in setting that up but doing it with a cast like this is perfectly fine especially for single player games where this is the only character you have and we're going to do that for both begin and end overlap now we're going to do the end over that first so going back to normal so setting the player to be not slip again just so we can go over the default values so as third person character or whatever yours is called we're going to get character movement and this should be all the way at the very bottom like so out of this what we're going to do is set ground friction connecting that in here and the default value for ground friction is a value of 8. then we'll drag out of character movement again and set breaking deceleration walking connecting line there and the default value for this is two thousand now you can double check this for you to make sure you a haven't changed it in B it is actually like this in your engine version because it has changed slightly from four to five so to do this you can just open up your character blueprint wherever that is for you select the character movement and search for what we did so search for ground friction you'll see it's eight and search for breaking deceleration walking you'll see it's two thousand so we can close this go back to our blueprint and again this is the only two things we're going to change the ground friction and the braking deceleration so we can select these three nodes Ctrl C to copy them Ctrl V to paste them and then just move them up to the begin overlap so where we're now actually going to make the player slippery all I'm going to do for this is set the ground friction to zero and the breaking deceleration walking to 350. now you can obviously change these values to be absolutely whatever you like but there is the ones which I'm using and I use in the Overview at the start of the video so if you like those values use these as well but these are just some which I found when testing out earlier so again obviously find your own if you want you can just mess up these values and changing them because obviously when you walk on Ice you do actually have friction on the ground it's not like there's zero friction but I think that looks the best and again these values work best for me so I'll compile save that and we can close it what I'm going to do now is add this into my level so what I'm going to do is Select my ice as this is just a plane I already have and I'm just going to copy the location by right clicking it on there then I'm going to drag in my slippery surface BP right click location and paste so it's in the exact same place so it's on the same height as well that's the main important part I wanted then I'm going to scale it up but instead of doing normally like this because that won't then work perfectly with the Box Collision you can see it's going up as well which obviously we do not want we're instead going to be using our size button we have here so I'm just going to increase this float variable like so and you'll notice this is now getting bigger and staying perfectly how we want so I think this is going to be good for me obviously it doesn't need to be this big but this is going to be fine for me obviously if you did have it this big this is actually possibly going through the landscape although no it's not because I've made sure to lower this down so this is fine but that is something to keep in mind make sure this isn't affecting anywhere else that you don't want it to be slippy now you'll notice again because I have them on the same height location they are Zed fighting which is that flickering horrible glitch we have here that's why I added in the show plane button we can untick that and now we can't see it again that's just a nice representation to be able to easily see where we actually have it but once we've got that we can hit play and this should now be working perfectly for us we'll go over to the ice and we can see we now have this slippery controls which we have here and if I had to stop walking we're obviously going to slide like this and if I take a walk on the grass it's going to be perfectly normal working fine for us so I think that'll be it for this video as we've done everything we want to do what we've done is we've set up this slippery surface in which as you can see here when we're walking we have less control we're sliding all over the place and when we stop moving we're going to be slipping and sliding like this as well and this only works in a designated area we set so if we to go over here on the grass it's going to be perfectly normal but if we walk onto the ice it's going to be doing it like this so thanks so much for watching this video I hope you enjoyed it and I hope you found it helpful and if you did please make sure to like subscribe down below so thanks so much for watching and I'll see in the next one okay [Music]
Info
Channel: Matt Aspland
Views: 6,892
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, slippy, slippery, slip, slide, slidey, surface, floor, ice, mud, slips, slides, slippery surface, slidey surface, ue5 slide on ice, ue5 slide, down slope, ue5 slip, brake, braking, friction, deceleration, ue5 slippery surface
Id: CRz6DSm8iRg
Channel Id: undefined
Length: 10min 29sec (629 seconds)
Published: Tue Dec 20 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.