Grab & release object

Hello everyone, and happy new year ! Wish you the best for you all. :slight_smile:

I have actually made a** BP** into my topdowncharacter_BP(not 100% finished yet) to **grab **& **drop **object, but now i want to be able to drop this object to a specific point in another BP.

---------------> For exemple in the game : If i have some wood grabed in my hand, and if i have a BP ā€œstorageā€ (like a wood rack), i want to be able to** put this wood grabed** into a specific socket into the **BP ā€œstorageā€. **(PS : i know that i can add sockets in a BP)
But i have noo idea how to make it work :confused:

This is the Grab & release BP i have for now :

Thank you all & have a good night/day !

@Krystoh I think the easiest way to do that would be with BP interfaces. That way, the execution can always be contained within the BP that is ā€˜gettingā€™ the object.

In fact, it would probably be best to destroy the actor and spawn a new component in the ā€˜acceptingā€™ BP.

So when the player uses the drop action, a line trace can ā€˜seeā€™ the relevant BP and call the interface saying ā€˜hey I just dropped something on youā€™, then the BP can take any appropriate action:

@ClockworkOcean Thank you a lot for your help, i donā€™t exactly see what you mean because iā€™m a beginner (even if i saw more than twice the video on your link), but iā€™m trying to find out and i will post here when itā€™s ok ! (or not ^^ā€™)

Itā€™s like this:

  1. Youā€™re holding the log

  2. You walk up to the log pile

  3. You press the key to drop the log

  4. When you press that key do a line trace and find the log pile

  5. Send a message to the log pile using the interface that says ā€œHey, Iā€™m dropping a log hereā€ ( and give the reference to the log actor )

  6. The log pile understands itā€™s a log and spawns a new log in the log pile and deletes the actor

  7. If you have tried to drop a log on something that was not a log pile ( but did implement the interface ), it would see the object type was wrong and do nothingā€¦

Thank you a lot @ClockworkOcean for your precious help, while you was writing iā€™ve found a solution, itā€™s not exactly like you said (i will try your solution also, to learn & also itā€™s maybe better), but anyway just to show you and also in case it can help someone else here (in the same order of the first pictures) :

Topdowncharacter event graph :

Topdowncharacter ā€œGrab Objectā€ function :

ā€œWood storageā€ interface, you learned me about (thx again :slight_smile: ! ) :

And this is the storage blueprint :

Iā€™ve not finish at all yet, but itā€™s (80% ?) functional.
Also i know itā€™s messy and not optimized, also i think itā€™s not the better and easiest way to do it, but iā€™ll do better. :slight_smile:

**Iā€™ll be glad to know if you have any comments, advice, help.

Thank you again for your time and for your help !**

PS : Just a little video to show the actual result : https://youtu.be/MXHN5LW_ToQ

Good to hear youā€™ve got it working, but I think you might have it back to front ( excuse me if Iā€™m wrong ). So you have F just to pick up the thing, you walk to table and click, but when you click it your character can also send a StorageEvent and inside the table it actually has this event ( a red node ) which handles the event.

If you do it that way, the code to have StorageEvent can be different for every BP, because the code is IN the BP, not in your personā€¦

Oh, please told me if i misunderstood, but actually the code is already in the storage BP (last picture).

The character have the grab & release (with variable boolean ā€œHoldingā€ & actor ā€œgrabed objectā€), and the storage BP contain the code who able to storage the grabed object if the player holding it & if the player click on the storage (the table).

I think thatā€™s what you explain ? :slight_smile:

No :slight_smile:

The RED node is the receiver, that goes in the BP. The BLUE node ( the sender ) goes in your character :smiley:

( Because your character will always send the message, and the BP of whatever kind will have to figure out what to do with the message, at the moment you have the log pile sending the message to your characterā€¦ ).

Alriight, yes i think understand now haha thank you !
Thx for taking from your time to help such a ā€œnoobā€ like me. ( Ķ”įµ” ĶœŹ– Ķ”įµ” )