Download

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:

https://www.youtube.com/watch?v=G_hLUkm7v44

@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. ( ͡ᵔ ͜ʖ ͡ᵔ )