Basically my character needs to walk up to the object and (without any further required action) physically pick up the object upon collision with said object.
Ideally, I would like for someone to explain to me the whole process of how to make this happen.
At this point I only have a character and the object that needs to be picked up, nothing else.
I don’t image this to be very complicated, but I am completely new to Unreal so I need this to be explained to me as if I’m a toddler.
Sorry if there is already a documentation on this - I have looked everywhere but only found tutorials that use physics handling, permanent attachment etc. and I haven’t been able to achieve this by watching these.
We’ll need to make sure the object can detect overlap events and we’ll also need to make sure there is an attach location for the object to attach to once it is picked up!
You’ll need to setup a socket on your character’s skeleton. This can be done by opening your character’s skeletal mesh asset and adding a new socket to the bone the object will attach to. For example, lets say it is a weapon, you’ll need to add a socket to the Character’s r_hand (right hand) and name it something like weapon, or hand. Then you can add a preview asset to that socket to get a preview of how the attached asset will look. If it is not positioned the way you like, you can select the socket and change the transform properties of it until it is in the location you want.
You’ll need to add a collision component (collision sphere or box) to the object you want to pick up and add an “Event Begin Overlap” by right clicking on the collision component and selecting that option. Then cast to your Character Blueprint, if the cast is successful, you can attach the object to your character’s mesh by using Attach Component to Component (I think that is what it is called). The target will be your character mesh and in the socket name you will use the same name you named it in the first part.
I understand this may be a little much to take in, and may not be on a toddler level, but I hope it helps!
I can provide more information when I return from work.
Thanks for taking the time to explain! So far I think I understand the logic but for some reason it is not working unfortunately. When I check the blueprint during simulation, I can see the nodes activating once the character overlaps the object, but instead of picking it up the character walks through it.
I might have done something wrong with my blueprints… I tried your method in the level blueprint as well as the actor blueprint, just to be sure.
It might be worth mentioning that the object is initially invisible and only becomes visible after another character activates a switch (done with a simple Toggle Visibility). Could this be causing any troubles?
Close! However, from AsKH Character BP cast node, you don’t want to get the Capsule Component, you want to get the mesh of the character and feed that to “In Parent” not target. For target, drag a line off and type “self” to find the “Get Reference to Self” node. And that should do it!
EDIT:
You don’t need to do the overlap event on your character, just the object’s bp
The “Target” pin should be the thing you want to attach (your key pickup) and the “Parent” pin should be the thing you want to attach it to…either the root component of your character, or you could just reference the actual socket component itself (omitting the “In Socket Name” value in that case).
Hi, sorry to bother again… but seeing how you have been able to help me out so far I was wondering if you could help me with a new problem.
The object I have is an animated key that bobs up and down with the help of a simple Timeline. Once my character picks up the key, I want this animation to stop, now it just continues. I tried several things and can’t seem to figure this out, although I’m guessing this has another simple solution
EDIT: ignore the “Stop” node in the screenshot, I accidentally left that one there after experimenting with it
Stadis, I’d recommend you post that as a separate question. That will help others out in the future when they’re searching for similar questions about timeline control and will also make it easier to track when it is actually answered adequately.