Attach and detach an actor to an other

Hello, I’m currently working on a 1v1 multiplayer game. The game is basically a mix between Baldur’s Gate 3 combat and BloodBowl.

I’m struggling to find a way to attach the ball (an Actor blueprint) to the character’s hand (a Character blueprint).
I thought about creating a socket in the character’s hand. By default, there’s already a ball attached to the hand. I created a Child Actor component in the character’s mesh, with the ball’s blueprint set as the class.

I’ve coded a function to throw it, which detaches the ball from the hand and launches it away.

Right now it’s still in a testing phase, so I haven’t set up collisions yet, which is why it goes through the ground.
But when I try to pick up another ball from the ground, I can’t get a proper result. I’ve tried several methods:

· Set Actor Relative Location

· Attach Actor to Actor

· Attach Actor to Component

I think I’m using the nodes incorrectly even though the solution shouldn’t be that complicated. Does anyone have a fix or advice ?

Attach actor to component is what you want, if you’ve not already, you have to get the mesh component from the character, and reference the bone name Wich can be viewed in the skeletal mesh asset. For attach setting I recommend snap to target, leave rotation relative and keep world scale

Thanks for your reply, but it doesn’t work — I had already tried that.

I’m going to try to describe my game in as much detail as possible to figure out what’s going wrong.

Each player controls 5 characters. When you click on one of your team’s characters, that character is stocked in a variable called ‘Selected Character’ inside my custom PlayerController (BP_PlayerControllerMultiplayer).
When you select a character, a menu appears with different buttons and actions (move, throw, pick up, attack, etc.).

My character has a ChildActor component attached to his mesh. The ChildActor is the ball, and it is placed inside the BallSocket of the skeletal mesh, located in the right hand.
By default, the character starts with a ball equipped. I throw it at the beginning of the game and then try to pick it up again by walking over the collision box I placed on the ball’s mesh. But I just can’t pick up the ball properly.

Just to confirm — the logic for picking up the ball should be coded in the ball’s blueprint, right?

I would recommend against using the Child Actor Component, it’s really buggy.
Instead use Spawn Actor from Class node to

  1. Spawn the Ball Actor in your Character’s Begin Play
  2. Store it in a variable.
  3. Use Attach Actor to Component to attach the Ball Actor to the Character’s mesh.

Also set collision for the Ball to No Collision

When throwing the ball, detach it, Enable Collision, Physics etc… then run the throwing code.


*quick low effort throwing code


Result

Thanks a lot ! I have severals questions

Why don’t you use a ProjectileMovement Component in the BP Ball instead of “Set Simulate Physics” and “Add Impulse” ?

Where do you set your collision profile name ? I mean what does “PhysicsActor” refers to?

But it will help a lot for my work !

I have to adapt the throwing part because I want to throw the ball where I click, in the throwing range of the character. It’s a top down view.