How to Pick Up Items in First Person and Equip in Hands in Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys welcome to New um real Engine 5 tutorial today I am going to show you how to pick up things in first person and equip it into your hands it's going to be a very easy video to follow so let's get started all right so the first thing I need to do is create the pickable item now in this case what I'm going to do is just right click in the cont browser create a new blueprint class and let's create an actor because it will just be out there in the world let's call this something as bpor you know item and then you can you know make Childs and change the parameters everything like that so this item will basically just have a static mesh which will be the model itself now in my case I don't really have a model so I'm just going to have for example I don't know uh what we can have like this uh this tatto this table you know it's just a let's put this tatue right it's um placeholder okay if you have a sword or whatever you actually want to pick up you would put it here um and that's it and then what we need to do is create a collision sphere collision and this will be the trigger now we're going to do is just make this radius way bigger and if the player enters in this radius we can interact with it so make sure down in the Collision settings for trigger that the preset is set as overlap all Dynamic that way we can enter and you know we will detect this item all right so now with that said we're going to do is create an interface so we can interact with this item without directly needing to reference the class which is better so let's just right click go to the blueprint section and create a blueprint interface let's call the same thing as bpis blueprint interface underscore interact and let's open this up so this will create a new function which we just name interact and that's it we can now compile save and close but I'm going to add a new thing which is going to be an output and this output will be a a static mesh because basically we will receive what mesh we want to equip so let's just go ahead and put the type at static mesh okay and we go static mesh object reference that way when we interact with an IT time we will basically get and receive what mesh we want to equip right so now we can go to the BP item go to class settings and in Implement interfaces just add BPI interact and there we go it is here so if I double click cck you can see that will open this function and the only thing I need to do is go here and make a you know print string for example and be like um picked up right and then just get the static mesh and then say get uh static mesh itself and then just plug it into the output that way when we pick it up we will receive the static mesh so now we just need to integrate everything to the player in my case I'm using the first person template so let's go to First person Blueprints and open up the first person character but of course you would open whatever uh you know blueprint character you're using and now what I going to do is go here right click and add an e key if you want you can add a proper input like in here with an enhanced input system but I have many tutorials on that too and now what I want to do is do a for each Loop and why well that's because we can you know get the overlapping actors of this player and as you may remember we added this trigger which if our player enters he will be overlapping so we will detect this item as we are overlapping and then we can just check with this node which is called the does implement interface if it has this interact interface and with a branch if it does we are simply going to go ahead and call the interact interface that we create which is here and as you can see we can use call from any object the interact function and we don't need to cast to you know bpor item right and then from here call interact now we can just directly do it universally for any object on here so that's cool and now with that said you can see we receive the static mesh but first of all let's go ahead and use uh drag this um you know item to the floor as you can can go here and when I press e you can see the uh print messages appearing at the top left of the screen right picked up picked up and so on now let's gock Qui is go to the event graph right click create a new custom event and let's call this something as destroy item and basically what we want to do is just destroy it right remove it from the game once we have picked it up so we're going to go ahead and just add a small delay and will tell you why we're doing a small delay two seconds and then just destroy actor self so it will destroy the item itself once we pick it up and why did we create a new custom event and that delay well that's because in in the interact function we cannot add a delay okay we can't in functions we can't and if we were to put the destroy actor before it would never you know get to this point where we want to you know go ahead and send the static mesh so we will have an error so instead we need to call the destroy item um you know event that we created which will have a small delay and it will let this go through all right and now when I pick it up you can see that it basically disappears which is cool and I cannot pick it once uh more again and then back in the first person character the only thing I need to do is go to my first person arms right just add a static mesh which will be the item and then just anchor this on the parent socket which will be for example the right hand right you can decide on that and then we would just need to go to item Set static mesh and what mesh it would be it would simply be this static mesh and right now if I press play go here and pick it up you can see that now we have it in my hand of course it's kind of just there um moving around very not very nicely that's because you know I just quickly added to one socket but another thing that we can do is just add it for example the to the first person camera instead right and we will just have it in front of the camera add big to the left right down here and you can kind of play around and then we we will have it basically there right so we can just change a bit the positioning right play around and has a bit better but uh maybe still too close right but I think like that should be pretty cool there we go and we kind of pick it up and there we go and you can of course do this with any item and expand it as you want so that's it guys if I found this video helpful I would really appreciate it like video And subscribe to my channel lots of un videos hand thr so check them out check out my uh patrons and members so you can get access to the F join my Discord server to talk with me and other deps check out my new course we G that to be how to make a stealth game in un real follow me on my socials and now yes I said [Music] bye-bye
Info
Channel: Gorka Games
Views: 7,651
Rating: undefined out of 5
Keywords: games, videojuegos, unreal engine, unreal engine 5, ue5 pickup item to hands, tutorial, quixel, megascans, unreal engine equip in hands, pickup item in unreal engine 5, ue5 get item into first person, equip item in hands fp tutorial, pop up animation, unreal engine 5 how to equip object, unreal engine 5 equip, unreal engine 5 item into hands
Id: v5D30Xn9GGc
Channel Id: undefined
Length: 7min 24sec (444 seconds)
Published: Thu Feb 15 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.