Creating Better Collision for Game Dev | Blender - UE4

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
now you may or may not know that the Unreal Engine 4 in unity can both generate light maps for you and collision for you automatically now in the case of light maps like we studied in the last video Unreal Engine 4 is actually really good the algorithm is really good at generating light maps for you and about 99% of the time it can do that properly but knowing how to do it does teach us exactly why and how specific things happen with our light maps so that we can understand how we can change our model to fix that as far as collision goes there are a ton of scenarios where you're going to need to create your own collision so that you have more control over how the collision is so let's get started and figure out how to do this one of the most important things to know about creating your own collision boxes is that when you're creating the mesh for the collision box in an external software like blender one thing you can't do is what we see here in this third object okay you have these inward sloping faces okay the engine that you're using doesn't matter what it is for collision will not be able to understand that all right and it's just not acceptable to the program and it won't create this collision so if you were actually to bring this collision box into Unreal Engine 4 it would go ahead and turn it into this collision box okay and so anything that has proper form to it and doesn't have any inward sloping faces into the actual shape itself will be accepted by the engine if it does have inward sloping faces it will correct that for you when you bring your object into the game engine taking into account what we know about N word sloping faces and collision boxes by looking at this tree we can determine that we're going to need three different collision boxes to handle this okay and like I said before the reason is because if we're going to draw our collision around this upper area and then come down here to this branch area and then down to the trunk we would have inward sloping faces here here and also here as well as there okay and so that wouldn't be acceptable by the engine so what it would do is just go ahead and draw our collision from the outside of this canopy here down to the bottom of the trunk of the tree so now let's get started on creating our collision boxes so the first thing I'm going to do is shift C to make sure we're centered there and we're gonna go shift a and add a new mesh we're gonna say cube and we're gonna scale this cube down you may have to play with the sizing of this a bit depending on how your characters are set up and how they collide with the tree based on the bone structure and stuff like that but general rule of thumb is that you just want to kind of you know have it slightly bigger than the tree okay so that when your character does collide with it if you have a third person game or something like that don't actually see the character's arm going through the tree or part of his chest or head going through the tree because that can be kind of ugly so you just go a little bit bigger and if you have to fix that later then that's something you can easily fix all right so we're just going to bring this box up to the base of the tree here slightly below it we're going to tab into edit mode and control tab select basis and grab the top face now we just hit GZ to bring that up to about here and even though we need to have a separate box for this area here we're just going to keep working from this one and then we can separate them later so we'll just hit E and extrude that up and bring it to about there and we're just gonna scale it out with this all right now we're gonna press Z to go into mesh mode so we can actually get a look at what we're doing here and we see that you know some parts of it are a little bit closer to the side and then some areas like over here a little bit farther we can choose to perfect this or not that's really up to you as the developer of your own game but I choose to so I'm gonna press gmz and bring that over a little scale it down and around sorry G and X and gene X to bring it back and right about there looks good enough to me and actually we can scale it down just a hair more and G&Y right there all right now while I'm in the mesh view I'm just gonna a to unselect everything in B grab this whole upper area press P and that'll let me separate by selection is what I wouldn't choose now I have a separate object so I can just tab out of this and press Z so that I can actually see everything I'm just gonna grab this lower box here and press G then Z to bring it down and I will tab back in control tab to edge and right or alt right click and select that whole edge there press F to fill it with a face have out tab into this one I'll right-click F to fill that with a face then I'll just select this lower box on an object mode and bring it back up alright and that pretty much takes care of the branches in our trunk now we have to handle the canopy of the tree so for the canopy we'll just start with another cube we'll just shift a mesh create a cube and G + Z to bring it up into the center here and scale it out just rearrange that a little bit more jimsy and bring it back down a hair scale it out okay now we can tab into this and hit ctrl R and that allows us to create loop cuts okay so loop cuts will go all the way around the object as long as you don't have a triangle breaking somewhere that would break your loop essentially as long as you're working in quads you can pretty much always use a loop cut and we're just going to use our scroll wheel and with our scroll wheel we can determine how many loops we want so we really only want to here so we'll left-click and that allows us to lock in how many loops we have and right click will drop it right in the center okay and we're gonna go s and X to scale that out bring it to about there and then we'll come over here control our scroll wheel up to get to left-click it allows us to set it and right click to put it in the center and again we'll scale this along the y axis so s and y bring it out and now we want to use our knife tool to cut out these external faces here ok so what we're going to do is we're just gonna hit K for knife and it shows us where we've selected by giving us that little red square there so we click on that and then we'll bring over here and click on this other vertice and then hit enter to lock that in and we're just going to do that all the way around the top like so using K here to here enter okay and here alright and now we're just going to run a loop cut around the center so ctrl R but our loop here allows us to set it and then right click to put it to Center and we're going to press Z to go into mesh and ctrl tab and choose faces then B and select the whole lower portion and we're just going to delete all those faces by hitting delete and then choosing faces now we can tab out make sure we have our object selected which is our canopy collision box and we're just going to go to our modifiers and we're going to tell it to do a mirror along the z axes and get rid of the X okay making sure that we also have merge selected so that merges together we apply that and we are going to tab back in and now we have those cuts that we put across the top on the bottom without having to go and knife all this we're going to hit Z to come back out so we can see everything nice and easy and we're just going to press C so you can quickly select these faces and note that when you're using C to select with you actually have to use right-click to exit out of it okay if you use the center wheel click to move around it'll actually unselect what you've selected like that so we just right click out of it press seat again and using our middle one to unselect what we didn't mean to select our middle mouse like that and we have everything selected we're just going to hit delete and delete faces now we can control tab select edge and alt right click that whole loop there and press F to fill these faces like so by pressing f2 Phil we're gonna change back to edge and we're just gonna right-click all these edges shift right-click them and hopefully I got that one I did and we're just gonna hit delete and dissolve edges to get rid of those all right and now we're gonna actually add that back alright and that's a little bit quicker than actually doing you know a knife from there to there to correct all those separations and we'll just hit a to unselect now we'll hit ctrl tab and choose faces we'll just grab this top center face and hit G and Z to bring that up just above the top of the tree there and we'll do the same thing on the bottom one gmz to bring it down just underneath the tree we're going to ctrl tab get our edges and we're gonna use alt right click to grab that whole loop okay and we will use g and z to bring it down and scale it out with s like so and then we'll hit z to see our wireframe mode and we see that you know once one direction of the tree is actually thicker than the other so we're gonna have to fix it so we can hit ctrl tab grab our faces and I like to when I'm grabbing faces to just get out of mesh mode because it'd be a bit confusing then we're just gonna hit s to scale and go along the Y we'll bring that in to about there and we'll check that out a ton select so we can see what we're doing and that looks pretty good to me so let's press Z so we can see everything will tab out of it to see all the objects and so now what we have here is we have this tree on the inside as you can see it's coming a little bit out of the collision box and the reason we don't really care about that is because it's not gonna really cause an issue when we're coming in contact with this tree okay there is a proper amount of collision here keeping you off of this tree and ultimately the goal with creating collision boxes is is to keep the collision boxes as simple as possible okay because if you're not gonna do that you might as well just use complex collision on your object in the game and you really don't want to do that because more faces that you have on your collision box the more it's going to hinder the performance of your game okay and especially on things like trees if you have an insane amount of vertices on your trees and they're all over the map and that's really gonna hinder performance okay so it's important that your collision boxes are as simple as possible now we get into the naming convention so that Unreal Engine 4 understands how to associate these to the actual tree itself when you bring them in so specifically for Unreal Engine 4 the way the naming convention goes for your collision boxes is you have your tree here so if we actually check our object data right here we see that the tree is named tree with a capital T so the first thing we want to do is just select one of our collision boxes and doesn't matter what order you do it in but I like to keep it in order and we're going to name this you see X capital you see X underscore capital T REE so that we're using the exact same name as our tree underscore 0 1 all right and for simplicity sake you'll just copy that will select the second box and paste that name there and it'll be 0 2 we'll grab the third box do the same and that one will be 0 3 now if you only had for example 1 collision box for your object then that collision box would not need the suffix at the end and it would just be you see X underscore tree of course tree is matching the name of the object you're associating the collision box with and that's all you would need but again we have 3 so we need all of them to be named individually with the suffix starting in 0 1 and continuing on for as many collision boxes as we have for a particular object and that's all there is to it guys that's all you need to create your collision boxes and an external software for the Unreal Engine 4 and again you may or may not need to do this for many of your objects that you use in the game engine but in many cases you will run into a scenario where you may decide that it would be better to have your own custom collision boxes and this is how you'd go about doing it in the next video we're going to talk about how we manually create our LEDs in blender for the Unreal Engine 4 if you appreciate the content you can help support this channel on patreon com toxicity gamedev make sure you hit that like button subscribe if you want to see more there's a lot to come peace [Music]
Info
Channel: Toxicity Game Dev
Views: 9,649
Rating: undefined out of 5
Keywords: game design, low polygon, low poly game design, game asset design, ue4, unreal engine 4, unreal engine, video games, blender, learn game dev, learn game development, learn blender, blender to ue4, blender and ue4, blender modeling, blender basics, game, indie game dev, collision boxes, collision ue4, collision blender ue4, video game design, video game, game dev, custom collision ue4, manual collision ue4, better collision, collision tutorial, better collision ue4
Id: Za462Y5H1WI
Channel Id: undefined
Length: 13min 39sec (819 seconds)
Published: Thu Oct 26 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.