How to Carry Physical Objects in Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys welcome to new Unreal Engine 52 today I'm showing how to carry physical objects around it's gonna be a very easy view to follow so let's get started alright so first of all let's create the actual physical object that we can pick up and really honestly it can be even these boxes but let's just make a new object just in case you want to make new ones so just in the content browser just right click go into blueprint class and let's create a new actor it's going to be a BP underscore and then let's say like pickable uh Optical grabbable like I don't know how we can name it but just clickable object that will be good so we can basically now just open this blueprint up and here we're going to do is add a static mesh basically the item model and what we can do is choose one in my case Lemmy is put for example the table okay so in this tutorial we're going to be picking up this table now an important thing is to drag the model into the default scene root this will basically make the whole parent of the object itself this is very important for the physics and so on and Origins and pivots and everything now with this selected let's go into similarly physics and enable this so it can basically move around have a mass and a row just physics so now I can drag it into the scene I can put a bit up now if I press play you can see it will fall and now I can go and start pushing it around so now let's make that we can actually grab this object so for that let's go into our third person folder go into Blueprints and open a third person cat blooper of course this can be any character blueprint that you use in the first person or whatever it doesn't matter let's go down and let me use for example use the left Mouse button it doesn't really matter you can use whatever key or input you want but in this case I'm just going to be making this so in this case I'm going to make an a sphere phrase by Channel and this is a quick way of detecting what objects I have in front of me as simple as that so I can basically just get the start point to be or get actor location so basically where we are right now and the end point to literally just be the same because the thing is that this is a sphere so it will just be a radius around a point let's put this to around 200 and I will play with those settings later on and now I can also change this to for example for duration so I'm going to preview this if I'm now a left leg you can see that I will be picking up any object that is around in this area and it's too big we can drop it down maybe 120 so of course you can test what you want this will basically be perfect I think 120 is good for me so we can carry on we can also close people object we won't need it right now so with this we're going to go and return value make a branch so basically if we have detected an object we can now continue in this case the out header will be basically we'll break it okay so we'll be now detecting this uh all the optic Supply now thing to do is actually instead of using its view trades by Channel this is another very similar note which is the sphere uh phrase for objects and basically this is the same thing but instead of looking for channels which is basically like the Collision settings we can do so by making our search through object types so we can literally just make an array over here and search through the physics body so basically if our um object has physics will be able to pick it up which will be more convenient so we can hold Ctrl mode down hold control hold down hold going for more down put 120 put this in a four duration delete this put it up and plug it into the branch plug in the routine value and break it and overall it would just be better for us because we will at least start only pick up and detect the artist that has Basics on not for example walls okay so now what we can do is add a special component that will enable us to pick up the objects and basically anchor it into our hands so in this case this will be the physical uh constrained physical constraint component this will allow us to basically attach things into each other in this case it will be the object that we have picked up into our chest zone or hands it doesn't really matter but basically around our character so we can do is get a fixed constraint drag it and say set constraints if I know how to type here set constraint components so we can now attach this into the troop and then the component one will be basically pen so what the component 2 will be attached to in this case OB dimesh so we can drag it on here now what we can do is pass a bone name in my case for our mesh if we search it over here and open up the skeleton we have a few bones in this case to make a sample I'm just going to attach it into the basically gladly chest so later on when we have our animation of picket with the arm suspended it will be kind of here so in this case spine five will do my job it's only copy the bow name and again it has to be exactly the same now plug into here so the name has to be exactly spelled like that now the component 2 will be the object that will be detected in this case the hit component and we're gonna just put it unknown because it will not have really bones with that said now if I press play go into my table and left click you can see that will be anchored into me but of course it looks like a string which actually depicts a Content can act as like that but basically we don't want we want to be a bit more locked so what we can do is go and edit the physics constraint components and on here we're gonna go down until we see the angular limit this is pretty much the rotation and so on so we can do is pass it in light now the thing is there's a problem we put in locked and overall it won't look very good if I now attach it it'll be like instantly snapped on and honestly it doesn't really look good so we can do is do an alternative that will be in middle of both so we can put it in limited and then lower the angle to around 10 let's say so basically it will have a bit of a wobble and so on and be like we are grabbing it but not be exactly um super attached as you can see this is much better it's a small kind of transitioning and so on we can even maybe expand a bit maybe even 25 can be an option so you can play with this settings but that will pretty much work pretty good so we can play with those settings over there all right so there are more things that we can touch but for now we'll go ahead and leave it like that but we can touch more stuff now there's still things done things to go and right now we can of course grab a table and so on but let's make the animations so what we can do is go into characters and go into mannequins and go animations in this case because we have Quinn that's going to Quinn now here we're going to do is get the idle animation and duplicate it and this will be basically the carrying animation now we can open this and basically edit it so let's place our handle in the star here go into skeleton tree if you don't see this when they just go in the window and then skeleton 3 and I'm going to go ahead and select my words with a cloud go left so basically it's pretty much like the shoulder right so here we can do is just get this axis on the Rotator I'm gonna be actually doing it in the local space it's basically rotate it around 70 degrees up then move it 10 degrees into the inside and then another 10 degrees up so now here I can just press the key and now it will be snapped into here now you can do the same with my other arm so let's go down into my cloud cool right this time then again I'm going to up around 70 degrees load it inside 10 degrees and then move it a bit up 10 degrees and now I can basically press the key button again very important now when I press play you can see that it will be like holding something and also his hands move a bit like following the animation this is great now we're going to save close it and now we can scroll back into our third person character and first of all let's make a Boolean so basically is carrying so I'm gonna make sure that we are carrying something in this case if we have selected something let's set the carrying to be be in here true but if not less at it to be basically false over here good so now let's go into our animations and open the ABP menu I know that we're using Queen but basically Queen is a child for many so we just have to change from one place now in the name graph let's go here and let's go into Mainstays and the things that we're gonna be adding a new state so I can just right click add State and this will be basically Counting and here I can skip the Locomotion Dragon Arrow then drag it from carrying to Locomotion back and now here we're going to do is create a new variable in this case this will be is carrying two so basically pretty much it's exact Boolean that we created before it's basically Boolean will be true or false so in here from Locomotion to carrying in this left Arrow let's double click and this rug is counting so if it's true it will transition now in the other one it will be the opposite so let's get is carrying and do a not bullying so basically it's not true so without going to go back over here and now we can open our state itself in here let's search for coming start animation and plug it here a very important let's select this and make sure that Loop animation is on right now nothing will happen of course because carrying is false but if I were to put it in as you can see here will be with the current animation make sure to set it false of course now let's go into the dang graph and let's add a new pane over here and get the in reference the character in this case let's use cast to our third person character or whatever character blueprint you're using and you did the logic and then here we can do just get is carrying and then get the is carrying in our blueprint animation blueprint and then set it depending on this so depending on what we have in our animation blueprint it would do so so now if I press play I can go into here I know hold this and now you can see that has the animation going on but there's a problem is that he's like standing still there it doesn't look very good his feet are not moving so what we can do instead is go into our anime uh blueprint going to carrying State instead of directly use past an animation we can do a layered blend per bone and this will basically split the body into I did already made multiple tutorials on this now this will be very importantly the blend post zero so is hold Ctrl move it down and blend post one will be like the bottlers of the body lower part and let's get The Locomotion so now here we can select this and open layer setup here and add a member this will be the bone that we want to split the body in this case we've got the skeleton I want to split it around in spine two so let me copy the name let's go back to animation blueprint and put here so basically from here the body will be split in two and for that as you can see when I press play and go and grab my thing he will be playing the animations while moving there we go now let's make it that we can also go ahead and of course drop it when we stop holding so let's go back into animation blueprint and in released what we're going to do is basically set it's going to be false okay and then also let's get the fifth constraint and I'm gonna say it's break constraint so whatever we have attach it will just break it okay and with that if we go ahead and grab it now we have to hold it so now while we're holding we can move but now when I as soon as I stop holding you can see that his animation will go back to normal and the physics object will be replaced now there's a few tweakings that we can do in order to basically make his let's say that this suitcases uh this thing's secure less let's say right so let's go here into the third person character let's go here and basically let's get the hit component and now set disable select this go down and say disable Collision so whatever right now we have equipped but basically grabbed it will not have any Collision so those things will not happen like basically breaking a bit the character movement which is very important so another thing that we can do is just decrease a bit the radius maybe I instead of 120 we can maybe put it at literally 70. so the thing is that the object will stay at which distance you grabbed it so if I grab a very uh soon very close it will be more close to the hands or not so you can play with the distance in order to grab it from where you want okay it will not always always be perfect but as you can see I can grab really any object that I want this is very very very cool you can really play around with this settings and actually two more things we're going to do is change the bone name to instead of being the spine I found that the neck will work a bit better so we can copy the bone and put it here it's just a bit up so Not Touch Too Much the ground and also let's go into here a component and then set the Collision in this case instead of being the normal Coalition they will have we'll put it into physics only and now it will be way smoother so that's it guys if you found so helpful a rip shake like video And subscribe to my channel lots of Unreal Engine photos so check them out remember that their profiles will be available in my patreon and YouTube members so check it out through the link in the description join my description follow me on my socials now yes to ourselves bye bye foreign [Music]
Info
Channel: Gorka Games
Views: 33,641
Rating: undefined out of 5
Keywords: games, videojuegos, unreal engine, unreal engine 5, ue5 carry objects, tutorial, quixel, megascans, unreal engine make carry items, carrying tutorial ue5, ue5 carry physical objects tutorial, ue5 grab object tutorial, how to carry and grab an object in unreal, unreal engine 5 how to grab items, grab models, move objects tutorial in ue5
Id: bCAlowYEYEI
Channel Id: undefined
Length: 13min 35sec (815 seconds)
Published: Mon Jun 12 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.