Pick-Up Items at Different Heights Unreal Engine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone in this tutorial we will create the pick up system that can pick up at different height like from the tables the Low T ball uh the ground and we add the widget to show where we can pick up and this tutorial is part of the tutorial series about Open Door and pick up so we will continue from this pick up item tutorial Let's Open Door project me go to Project setting and set the SM s that the model set d3d well and enable this and restart now in the last project I use Andre engine 5.0 to create this system so if you need to update to engine 5.3 you need to go to animation low print to the control r and we need to update our control R find it and open this set fot Control Function for Unreal Engine 5.3 you need to use this R element key because the last Vari ball item RI ball is is not available to change this and everything will work in engine 5.3 close and next we will import our animation I will provide by the animation Link in the description so this is the same animation but I modify it for different height of the location that the item that we will pick go to animation and drag this animation grab animation po skeleton is SK mannequin and import all and then we go to pick app then import this table and we don't need to create new material do not create material import all and go to sub person create new folder name widget import this texture image if we open the person blueprint and when we play the animation Montage we need the notify collect add and Target so this new animation we need this notify tool open this lifting and this is the target when we start to inall the control R of the hand and this when we collect the item and this is the add of the animation so this animation let's create create animation Montage open it add Montage notify and the name is collect and this we add another Montage notify name is and then we put the hand down add another monage notify name is ADD and create and the anyon this when we grab and notify notify and this when we love the control R of the hand name is Target and add animation notify name at and grab four let's create any monage and here is Montage notify collect and we add another notify I get then it and S the this animation montage and we delete this delete this item and this C call and move this door back move this item here and next mod this ler start and go to this table use the first table and add this s item on this table and let's play test and when we grab this we play the lifting animation not grab animation now go to Sur person and character first we need to clean this project first by creating the function for some of this event add new function the function name is get all item and get items array and clear this then get spare get overlapping VOR for each Loop call is colable then create a branch and if it through all is valid this array element is valid get item and add unique add this array element to items and when we complete return copy this item and return this name the output to return items compile and go to even graph this get all items is used instead of this get all item even and this add collectable item we can delete this we delete this and get all items next we open this find nearest item we need to change this riall to local riall because we want to call this function many time and it will not override the data of the variable so this templ let's delete this and add new local rall name is H clo and another one is HEM nearest item that is two actor then let's set this templ set it to high value is 1 million and we can delete this nearest item get temp FL here and we need to set this rall is valid here and connect this Vector length to this template and we delete this nearest item you set H nearest item and this function at input the input is items and set it to array and when we complete for return get temp nearest item variable and connect to this return note rename it to nearest item and compile and save this go to even gra and we connect this return items to items and call set nearest item make this result to this and let's save this next I want to change this location and create this as another function so C on this and right click LA to function and change the function name to find work to location and set it to Pure function open this function and this B to location if the item is on the floor I don't want the character to work on the location of this item it need to have some space between the character and the item to reach and grab so let's add another function the function name is who item animation and we choose the item animation depending on the height of the item add input rable name is item and set it to single all is valid yeah exor location and split this get actor location plit and we subtract get capure component you can trag it from here and get get Capal half high and we can subtract Z with this and this height of the the item location and when it's valid create a branch and this value we compare it if it is less than 30 connect to the branch if it less density set the item position so let's create another variable item position and set the variable type to integer set this two variable and item positions set to one and in R Cloud Min is 30 and Ma is 60 and this B is includ s Max we don't want to use the 60 and Cy this and set it to between 60 and 90 and another animation happen when it is greater than 90 and we create the if it fall and connect this and copy this item position withow sorry and this is is fall and the true we connect it to the item position and when it fall the last one and set the end item animation to two 3 4 and this is error we don't can't find the animation location so set it to minus one for return to return note get it position and connect this to return and we already finish this choose item animation compile go to find work to location add input is item actor all is valid and and this item we get the actor location then call get item from the input post item animation and equal if it equal to one it mean that the animation is lifting the item from the floor and not buan if it not equal to one it mean the item is not on the floor we call Select post this select and use this location if it fall and copy this item get actor location and use this location if it true and return this value connect it here to the return and this captal component High we want to get actor location split this subtract this Z and it to Z because we want the system to work when we put this item on this different high like on the static mesh so it can calculate the animation that we should use and let's compile close all of this function go to even graph and find walk to location get nearest item and connect it to the find walk to location copy this and connect it to this same point move to location and set this radius to 2.5 we want to debug the the path that the character work to so add another function name is the back and variable the variable name is H points and set this to vctor and set it to array get P points all clear and add input name is p add the add location so vctor app find part to location synchronously to part at getor location to part start and we get at Point from the result set to H points variable and call for each Loop withraw the spere draw the back Sphere for this location radius is five line color green duration 10 and thickness is 10 save this compile and we call this de back after we move to location and use this find B to location as the add part and we can adjust this rotation rate to 180 and this one is 240 let's compile and save and press e now we can see the deug and everything is working correctly like before next we need to P this animation Conta depending on the height of the item and before we change this let's copy this collect item set it to fall and set it to fall after we call the add notification and this one we delete this and next we add the table this low table add it here and move it here and this high table and we add this light item on the table and this one and this low on the ground let's see the name m and we can see that this head ball we still can walk on it so go to Project set all setting search for now and this ceiling high that is 28 this one to8 and this high to8 and this cell side we can adjust it by divide it by two and this divide by two and divide by two and let's save this and we cannot walk on this table now can move it near this I think this Gap is too far we can adjust it by go to this t ball and open show the simple colation click on it and to scale I want to scale it a little bit smaller than actual size of these table it's to much that it to 0125 and scale this so open another table do the same and another T ball and SA now this boundary is changing open third person blueprint and this animation Montage we get nearest item post item animation subtract this item position by one and we select [Music] Montage use this inex because this index start with one so I need to subtract it with one and add pin we have four animation go to animation the first is lifting animation the original animation scan grab two grab three and grab four and can I show this play Montage we can play test now let's go to this location and walk through it and we can grab and we need need to adjust the hand to grab at the right location close this project setting and go to Sur person character go to ABP man to event gra first I want to adjust this this s Trace I the target set it to0 Point 92 to lower the string of this leg ik when we turn the animation they set Trace hand item need to add another variable the variable name is item position and set the variable type to integer set this to Z and set this to the item position we go to this event set Trace hand item double click and this function let's add another variable input is item position and set the variable to integer compile and Save and connect it to item position at this I hand item we want to change this we want to change this adjustment of the character and I location depending on the animation of the item position first we select all of this and collap it as a function name this function to door handle transform we can move this mes to here and select all of this right click C two function the function name is select all item transform and we can connect it to here this blue print look cleaner than before and move it here and we open this function and change this name to item transform change this to character transform add variable the variable name is SC array app name is R type is float and array duplicate this control D name is scaler array right this is the right Vector adjustment and scer array for and we can set this category to adjust position change this to adjust position and this two and we compile and this character get actor app Vector this is the right vector and this is the forward vector and multiply convert this to Lo and we add another pin add it here but this to float remove pin so this is the position of the item and we want to adjust it with the VOR up right and forward and this adjustment value we store it inside this array get reference and this item position first one get this position and this forward and position and we can compare this and this SC scalar array app we have five animation position the first one is when we open the door and the second one for lifting the object from the ground and and this three is different height of the table so we can add P the five element and adjust 1 minus 30 13 13 13 this scal array R we set it to 7 1 7 s 7 and scalar right forward is eight well one one and one you may have a question that how can I get this value this value we get from when we play the animation because we need to adjust the hand of the character so if you want to move up stronger you can adjust this index to index value to high value and if you want to move it down it's negative value and if you don't want to adjust it set it to zero and this one is when we adjust it to right we go to S person character and this index position we not yet call set this value for the set TR hand item this function send the variable data to the animation blueprint so we need to set this item position and this one let's play test now we have the correct position import this one is it correct and I want to adjust this scer array forward this one set two five for the low table it's not accurate now it accurate right and we have some problem we want the character to walk to pick the object not run to pick it so we need to adjust the box speit to thir person character and add function the function name is adjust make work speed sorry get TR and create a branch get actor location get add points get a reference line subtract it with one get another reference and copy this subtract it with two find the distance between this and this one this 10 L than and another one less than 100 and call all Boolean create a branch and connect when it fall get character M then Max for Speed if it true we set it to 500 and if it fall we done set it connect this to return this function we want to set the speed of the character to 500 when we nearly arrive at the location of the item so go to even graph and go to A1 take this collect item after this Branch we call sequence and set adjust make speed and when we pick up this item we need to set these two lower speed for the character to work set max work speed and set it to 230 and we need to initialize the part points of the character that need to walk through the item get actor location get nearest item find walk to location find hat to location and we get add points set at points and connect it here and connect back to this is valid compile save this let's play and now the character walk to the location and pick up the object I want to prevent the character from pick up the item when the item is blocked by the static mesh and when the item is far away from the hand reach so let add function name is block by mes input item actor get actor location break this vector and make VOR get capture component yeah scale half High add it with z and get EX location from item and call line Trace by Channel this is the start location and the add location and I want to debug it for duration for return return value add another function name is is reachable to even graph copy this add points and connect it and input the name is item and get vctor location of this item get the length of cut points subtract it with one it is the last point of the add point and get copy use this Index right with and break this Vector tool make vctor and we only connect this X and Y and find the distance vctor between these two location and if it greater than 65 y we return and return this Boolean and let's add macros the name is hand to input input nearest item add another move with app change to execution pin change this name to execute so we don't have this name on here and is valid call block by mes and connect this nearest item when we return create a branch and if it fall all is reachable and this nearest item create a branch and this output one is can and another one is can and if this reach ball through that it to can if it fall is can if this through can and it's not valid can so let save this go to even gra and call this andb to and use this nearest item it and connect to can connect to this and we can delete this function let's duplicate this table and item move it here and duplicate this static mesh rotate at 90° move to the table and this there this we don't need to show na mes this B this and let's play test now we when we go behind this ball and press a we have the line TR if this line cide the character cannot go to collect this item and if it not Collide the character walk to the location and collect the item and another prevention you can duplicate this table and scale this H to 5 y to 5 and let's duplicate this item move it here and you cannot reach to this item so let press a and now it too far we can walk to this let's delete this this can work tool blck by mes we don't need this de back tun and this theb back P we ignore this if you want to debug just connect it again to make the animation look more realistic when we turn in place I want to add the head turn a little bit when the C turn go to BPI and name and add another function name is set head rotation and add input Rotator the name is angle rotation and add input buet set it to alha and save this go to ABP Manu this even graph and we can close this function call even set head rotation and promote this two variable the variable name is head rotation and promote this two variable variable name is headbone and set it create a branch if it true we set this rotation if it if it fall we don't set it and this update animation at another pin down here we get headphone and create a branch connect it to this sequent add another variable the variable name is head Alpha and set it to integer the float get head Alpha F in to I get is one get Delta time get B Delta second it to data time and inter speed is one let's set this at Alpha when it's through and when it B this like this fall I get is zero in speed is three and compile go to en name gra call transform bone and connect it to this component post and it here get head Alpha connect it to Alpha and we don't need this translation and this scale and this rotation add to existing get head rotation and connect it to rotation Cy this for another bone this one choose next two and another one is PL one and this Alpha we can divide it by two make it to this ala go to sub person character and this turn to item event we colap this as a function the set actor rotation name is set actor turn rotation and this name is turn value open yeah my M we get this m get any name instant for set head rotation message and this turn value we call map range clam 0.2 to 1 and this range to thow to one because the value we get from this timeline the lowest value is 0.2 and the highest is one and we want to map it to zero and one multiply make Rotator connect to this Y and for turning right we multiply by 35 and copy this pass it move it here connect it and for turning left we multiply it by minus 25 go to event graph and when we stop turn the item get M the correct ter is and get actor instant get En name instant call set rotation set head rotation and set it to this rotation is zow and this one the alpha is true and go to even graph this turn to door we do the same that actor turn rotation function it to Z value and delete this and when we stop copy this and name instant that head rotation in set head rotation to zero and another adjustment I want to stop this adjust this walk speed for the door when we go near the door so let delete this compile and save let's play and go to this and we can see the head of the character turn a little bit when it turn in place next I want to add the widget to appear when we walk near the item that I want to collect go to sub person and bridet add user interface vget blueprint user vgit WB inct open it and search for canvas this canvas panel overlay Horizon all box overlay B the image under this border and T in this overlay and another tag in the horizontal box we adjust this overlay anchor to Center and move the to Center position line is 0.5 and 0.5 side to content and adjust this Ed position to 245 and this overlay that it to fill this border let's set the image first the brass image we set this T UI PC key let's change this mxi to 64 and 64 and this border that it to horizontal alignment is F this partical and adjust this heading this two eight and eight and change this PR color to throw Alpha and this Tex set it to the Tex a to the center and this spawn Hing it to regular another Tex block this tag name is grab and set it to this what it call pange the font toot tiny light size is 32 compile now we have this widget go to graph I forget to set this TCH that is to variable so we can call it from this R ball add a custom even the name is set TCH and input Boolean open and create a branch get Tech Block that Tech if it through P the T to open this is B the door and set t if it fall hang back to grab for the item p and sell close this WB inter to person and character add new function the function name is add interact wiet and input is open and call create widget tools w b interact and promote this to variable the variable name is interact widget and get this inter widget is valid we create this widget when it is not valid and then add to to view part get inter wiet call that t and connect it to open compare and add another function name is remove interet get IND vet variable is valid and if it is valid we remove from parent and set IND direct vet to MT to event gra create a custom event name is request at widget and another one is request create custom event request remove widget get door and call is valet and only add the widget when the door is not Val it and then we get all item find nearest item and this nearest item called can walk to if we can walk to the item we add inter widget this prevent us from the item that cannot walk to and the icon still appear to the player so copy this and if it can work to we remove inct wiet for the spare scoll down begin overlap and add overlap oh here and the actor has to BP collect item if it through we get collect item and create a branch when we not collecting the item this will prevent it from player that playing the animation montage and this icon appear so when it fall we can request Twi add widget and this add overlap request remove widget command on this name it to widget and this collect item Montage after we collect the item it's add notify we call request add widget to search around the item that is there any item that that we can col it or we can grab it when we press a and it fall call remove interact wiget compile and sell let's play test we still cannot see this sorry that the vet did not happen because this reachable this item we should connect to this find walk to location we don't use this nearest item let's compile sa play test and when we walk near this item we have this grab and when we walk out of the range of it it disappear the widget and after we finish collect the item if the item have the distance near it it will show the grab widget next we want this widget to open for the door go to thir person character if gra and this even set new door we call get door and is valid if it valid we add widget inter widget and set open to through for opening the door and if it's not valid we remove interact wiet copy this this play Montage for opening the door pass it here after we set col door and this two and go to the door go to BP door and this overlap to prevent the overlap for full time and the component check if it equal to player capture component and create a branch if it true we set new door if it not true we done set it but to person character I want to adjust this turn to Door even and this value set it to four to avoid the error save all let play and here when we near the object that we can grab it so the grab and when we near the door it's so Open Press e open the door and after we open the door we have this weet again to open back and let's check if it's working for the is top location it's still working so thank you very much for watching if you have any question please leave it in the comment section below and please subscribe to my YouTube [Music] channel thank you very much for my patrons member who are supporting me your your support really mean a lot to me see you in the future tutorial I'm overheated can hardly sleep at night
Info
Channel: jourverse
Views: 5,802
Rating: undefined out of 5
Keywords: unreal engine, unreal engine tutorial, ue4 tutorial, hand ik tutorial, control rig tutorial, procedural legs ik, arm ik, mixamo animation tutorial, pick up tutorial, pick up unreal engine, pick up item, pick up, pickup, pick up item ue5, pick up item with ik, press e to pick up, pick up system, How to make pick up item, best pick up tutorial, Hand IK, pick up on table, table pick up, grab item, grab object, grab from table, pick difference heights, interaction tutorial
Id: f6lsyvDQ67g
Channel Id: undefined
Length: 97min 38sec (5858 seconds)
Published: Mon Mar 04 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.