Okay! So you’re getting it detected. Now let’s go a step further. Instead of physics body you’ll make your own channel! Unreal can carry up to 18 custom channels.
You’ll start by going to Edit>Project Settings on your main page and searching for “Channel”.
Here I have the two custom channels I’ve made in this project, “Projectile” and “Interactable”.
Click New object channel and make one for your ball, if you plan on there being other things to interact with I’d just go with something like “Interactable”.
Now go back to your sphere trace and set that “Object Types” to just include “Interactable”. Then go to your ball and set its collision on the static mesh to “Interactable”. I tend to set it like so (but you can change these):
Next, go to your Sphere Trace for Objects and right click the “Out Hit” pin. You’ll then click “Split Struct pin” and it will look like this (you can ignore where it says “Line”, we’re looking at the right side, it should be identical).
Now you’ll pull off of “Out Hit Hit Actor” and do an IsValid check, because if you didn’t hit anything you don’t want to continue.
Next, you’ll check to see if it’s your “BP_Grab”. I don’t have that so my “= Class” function is empty but you need to fill it in.
Now, provided all of those things are true,
You’ll do a cast to BP_Grab. Then tell BP_Grab to do whatever you want off of the “As BP_Grab”
Make sure you do your checks. You don’t want to do the cast if it has no point, you’ll get errors!