How can I interact with actor component?

Greetings!

I’ve just started to use Unreal Engine and I’m still trying to understand better how it works.

I’d like to know how can I change my BPs so I can interact with a door only; without interacting with the frame at the same time. I want to interect just with the component “Door”.

That´s because I’ll want to use this mechanism to open car doors later, but the doors gonna be together with the body, on the same blueprint.


Can you explain me or show me how can I do this?

Thank you for now!

1 Like

There are many ways, but a pretty common one, is still to talk to the actor, but pass the name of the component you’re interacting with. It’s available in the trace results.

A second way, is to make a blueprint that inherits from ‘static mesh component’. You can put code in it, and talk to it, but also still use it as a component.

A third way is to make the door an actor in it’s own right, and then include it in the blueprint as a child actor component.

First it easiest to use, I’d say.

1 Like

Thank you for the answer!

Is there a chance you could show me some practical examples?

Maybe the first option, since you said it was easier.

1 Like

I will drop something in tomorrow ( not at machine ). In the mean time, pop this hit result open a bit more and pass the component as a parameter in the BPI call

1 Like

Thanks!
There’s no need to rush. I would really like to learn and understand how it works.

In the door bp, select your door mesh component and add a tag (details → component tag)
In the break of the line trace do this


connect that branch between “Interactuable” and “OnInteract” :neutral_face:

In my player, I can make this call

Notice, the type of the component parameter is ‘primitive component object ref’, I also need that in the interface definition

And then in the blueprint, I can see which component was clicked

In this way, I can always move the one that was clicked

component

But of course, the main thing you might do with the component is change what happens depending on which thing was clicked, in your case

So you can differentiate between the door, handle, frame, etc :slight_smile:

2 Likes

Thank you very much!
In addition to being exactly what I wanted to do, I learned very easily with the practical example you gave me.

1 Like

Hey, you’re welcome! :star_struck:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.