Picking up object and attaching it to another object

I want to pick up a ladder and attach it to the ceiling but I have no idea how I can do that. I already made a blueprint to pick up items with E and now I want to create a triggerbox where I can press E again to attach the ladder to the ceiling.

I can’t find a solution to my problem so that’s why I’m asking for help so I hope you guys can help me with any tips or links. If you need my blueprint then I can provide that too.

Hey there,

This sounds like a good way to use Interfaces.
So, right click inside a folder and choose Blueprints → Blueprint Interface and name it “BPI_LadderAttachable”.:

Inside it, add a function called “TryToAttachLadder” that gets an Actor Reference as Input and outputs a Boolean. call the input LadderRef and output Success:

Create an Actor called “BP_LadderTrigger” or whatever you feel like calling it. Inside it, go to “Class Settings” and in “Interfaces” choose “Add” and add the interface BPI_LadderAttachable that we created:

Inside this Actor, add two components: (1) Scene component called “LadderAttachPoint” (2) Box collision (to detect when player is near). Compile actor and then, in My Blueprints tab, usually on the left of screen, look for the Interface Function we created called “TryToAttachLadder”. Inside this function simply drag the LadderRef and choose “AttachToComponent”. The component will be the LadderAttachPoint. make sure it’s location and rotation Snap To Target. Afterwards, return Success:

Last step is: go to your character (which holds ladders on E) and add the following logic:
When you grab a ladder, save it in a “HeldLadder” variable. When E is pressed, check if HeldLadder is valid.
If it is, get all overlapping actors of type “LadderTrigger” (if player inside the Box Collision we created, it will trigger) and try to attach a ladder to them using the Interface call we created. If the ladder was attached to something, we will set HeldLadder to be Null to know we are no longer holding it.
If HeldLadder is InValid, we will try to attach a ladder to player (using the method you said you already implemented).

Hope this helped. Tried to be as specific as possible.

Good luck

Oké thank you very much, Im going to try it out and see how far I can get!
I’ll let you know when I’ve done it.

If it worked, please mark what I wrote as the answer so others can use this thread too. Thanks :slight_smile: