How Do I Attach Ball To FP Character??

Hello smart people,

I am making a Handball/Dodgeball style game as my first project in UE5. I am doing this in a First Person project and have imported the Ue4SP_Character so I have a full body (I plan on failing to make it multiplayer later).

I need my character to be able to approach the moving ball and pick it up using an Input - snapping to a socket on my character’s hand (On Press E in this instance). I’m not concerned about animation at this stage, just functionality. The other element is that opposition players can block the ball (once thrown) so physics/collision needs to exist (be re-enabled after throw).

I have tried for a two weeks, using various docs, videos and tutorials (mostly UE4) to figure out how to do this and all I have from them now is a functioning Line Trace which recognises only the ball. I have also tried collision spheres/overlap, disabling physics on input event, rooting the ball’s SM, casting and attaching to everything and I haven’t even made the ball move… Other than walking into it of course.

So the question itself would be, what is the best node system for me to pickup (to socket) a ball (physics actor)?

Please, I know it’s simple but any direction on this would be incredible.

Thank you

Hey there @Archebiosis1! Welcome to the community! So a think many of these tutorials don’t mention is that you cannot attach a Simulate Physics enabled actor to your player. It just doesn’t react because it’ operating on an entirely different movement system. So what you need to do is when you make your trace to the ball, disable simulate physics, then attach it to your hand socket. Would probably look a little like this:

Just make sure your ball is the root, if it’s not the root of it’s scene component it will fail anyway.

Hope this helps!

You can always not do that, and have the ball always be in the player’s hand, hidden. Different ball than the physics one. WHen you pick it up it goes invisible, and the hand one goes visible, just gotta line it up, which can be done by moving the position of your hand-ball before setting it visible.
Then when throwing, it goes invisible and the physics ball goes visible at that location, with the proper impulse.

Agreed! It’s often best practices to fake thrown items so you don’t have to handle them back and forth, especially for things like grenades, dynamite, and even dodgeballs! Often attachment is used for things that are going to remain attached, or things that have persistent effects that would be more work to pass around than to just attach and detach.

As others have said… Fake ball attached to hand. Hide/unhide as needed.

Easiest option for the thrown ball is to use the Projectile Movement Component and its built in “Bounce” functionality.

Basic Ball structure…

  1. Sphere Collision (root component)
  2. Static mesh (visual reference of the ball)
  3. Sphere collision (Interact collision, works with BP Interface)… make this a child of the mesh.
  4. Projectile movement component

On pick up destroy the projectile ball, unhide the characters attached fake ball.
On throw spawn the projectile ball, hide the characters attached fake ball.

Better to use an object pool for the projectile ball vs destroying it.

To sync the hide and spawn steps you can use anim notifies in the montages.
At the apex of the throw create an anim notify.
Anim notify event → Spawn projectile ball → Hide hand ball.

Same process can be used for the pick up process.

These replies are fantastic, really needed this exact clarification/direction, thank you so much.

I have tried something very similar to @SupportiveEntity’s setup but I have weaknesses in understanding context/syntax (which I am working hard to address, Unreal is a phenomenal teaching resource!) so likely I mispositioned a node or two, making this a very helpful reference. Thank you for defining attachment use also, that makes a lot more sense to me now.

I know both these processes have been suggested/described in other posts so I apologise for the repetition @anonymous_user_b04a32c1 & @Rev0verDrive. I believe I misunderstood the application of hiding/unhiding but excited to learn the process as it must have myriad applications. I will try that breakdown on ball structure too @Rev0verDrive as that should circumvent a lot of issues I have come up against.

I will try both ways to expand my knowledge and mark as solution a bit later.

Thank you all so much again, you really helped me today and I hope I can repay the community somewhere down the line.

1 Like

Absolutely great to learn all you can! Both mechanisms will be useful, but it’s definitely considered best practices to go with the false throwing. That said, I’m just chiming back in to remind you that you are helping the community by asking questions, next time someone finds this thread, they will have their solution. That said, just a reminder, when you get a suitable answer you can mark it as the solution and it will appear in your original post as the solution for everyone that ends up here later!

1 Like