How to get root component of grabbed component in PhysicsHandle

I created an interaction interface which passes both a component that the player is looking at when clicking Mouse1 and a PhysicsHandle Component of the player character to another blueprint. So when you hold one actor in your hand, look at another actor and press Mouse 1, the BPI_Interact interface will pass the looked at object reference and the Physicshandle to the blueprint you clicked on.

I want to check if the player is holding an actor and if that actor is of a certain type so that I can decide if, for example, I can fill a cup with water, if the player clicks on it while holding a water bottle. I already made a different post that goes into what I’ve already done:

The problem is the Equal check that I do to find out if the object I’m holding is equal to the ā€œwater bottleā€.


this is how the physics handle and the looked at component are being passed to the blueprint.

But when I click the object I get the following name printed out from Get Display Name:

image

So the thing I’m checking for is ā€œBP_DC_Pappeā€, but the display name comes from the static mesh component of the blueprint: ā€œBP_DC_Pappe.DC Pappe SM_DC_Paperā€

So it gets the child component of the root component that I’m actually checking for, I guess. So how can I get the ā€œBP_DC_Pappeā€ from my physics handle so my equal check actually works?

EDIT: I have tried to use Get Owner on the grabbed component. It has the same display name as what i want, which is ā€œBP_DC_Pappeā€, but it still doesn’t register in the Equal check. So my guess is that the AActor reference for ā€œBP_DC_Pappeā€ is not equal to the ā€œBP_DC_Pappeā€ Blueprint?

1 Like

I found the answer:

What you need to do is not use an actor object reference (blue) but an actor class reference (purple) as the thing you check to be equal.


So you first get the PhysicsHandle from the Interface function implementation (red, Physics Handle pin).

Then you get the grabbed component
Then you get the Owner
Then you get the Class of the Owner

With that you make an equal check that is set to the actor class reference of your desired object.