Am I doing this the right way? How do I check if actor has been attached?

I created a BP_Ball blueprint. When my player BP_ThirdPersonCharacter runs over it, the ball is attached to the right hand/socket. I am handling this logic in BP_Ball.

Now where I am stuck: How do I check inside of BP_ThirdPersonCharacter to see if the ball is equipped (boolean.) This way I can setup logic to throw the ball next.

I tried creating a variable called CurrentBall with a value of BP_Ball but it doesn’t do anything/work.

Also should I be handling the ball pickup logic all inside of BP_ThirdPersonCharacter instead?

Here is my logic inside of BP_Ball:

from the perspective on the “Ball” out of the this/self GetAttach. this will walk up the attachment chain until it finds another actor (it can return null, so test for IsValid() before working with it)

from the perspective of the “holder” you can run a GetComponents(Ball) which you would then iterate over to see if one of them is the “Ball”

as a general thing: give the ball an Actor pointer for “holder”, and a function that returns a bool. When it is “picked up”, have the ball compare the current holder to the new one, and if they are different return either true or false (just be consistent).

As to which perspective is “better” will mostly depend on what is easier for you to use.

there is “separation of concerns”: the “holder” cares about if it has a ball for possible valid actions, and a “Ball” cares about what is currently holding it.

data overhead, if the ball has a pointer to actor there is no real cost beyond the 4bytes of the pointer. if the holder knowing about a ball would only matter if the ball for some reason would not exist in the current level.

you can also call SetOwner() on the “ball” with the “holder” that would give you an additional access method of GetOwner(), but this is an additional bookkeeping step to undo when that needs to happen

Hello @ryantactics ,Welcome back to the forum!
Here’s a possible solution that might help you:

First, you’ll need to create an IA_Throw(DigitalBool) and then add it to the Input Mapping Context with the key you want to use to throw the ball.

In your SK_Mannequin, create a new socket named Ball_Socket, which is where you’ll attach the ball to your character’s hand.

Then create a BP_Ball like this: in that Blueprint you’ll enable and disable physics and collision on the ball as needed. You’ll call this logic later from your BP_ThirdPersonCharacter.


In your BP_ThirdPersonCharacter, create the following variables and set up the logic to detect whether your character has a ball in their hand or not, and to allow them to throw it.
First, you check if your character overlaps with the ball and, if they don’t have any ball in their hand, you run the logic to pick it up. Then, if the character already has the ball in their hand, they’ll be able to throw it.



I’m also leaving you a video that explains how to add animations, which might be useful for you.

Hope it helps!