Making static meshes interactable by applying blueprint logic to them.

So I have uploaded a 3D model of a house to UE and my goal is to make all the static mesh elements (walls, door, floors, etc) interactable. To do this I have been working on making blueprints (started with walls) that would allow me to to walk up to a wall and press a button on my keyboard to change the material of the wall. However, the problem I have been running into is that when I apply a blueprint to a wall in the house I am only able to give 1 single wall any sort of interactability. If I try to apply that blueprint to a different wall it will just replace it entirely.

Ultimately, I would love to be able to apply 1 blueprint to a few different static mesh actors (walls) and be able to change the materials by walking up to them and pressing a key.

1 Like

You need to make a parent blueprint, which contains a mesh and some code.

Then, for a wall, or a door, all you have to do, is change the mesh, you can make it a parameter.

The code in the parent BP will contain basic interaction, but when it’s a door ( for example ) instead of changing material, it could open. This is something you write the code for in the child BP.

Thanks for the response!

Im pretty new to UE, but would I need make multiple different parent blueprints?

Also would this allow me to apply the same blueprint to different wall meshes?

1 Like

One parent BP.

Each interactable mesh after that, is derived from that parent ( when you make a new blueprint, you choose your parent class, rather than ‘actor’ ).

It’s easy to know what goes in each one. Everything they all have in common, goes in the parent, everything specific, goes in the child.

For me I have basically everything in the parent. Highlighting, timelines etc. Only the stuff specific to the case you’re dealing with goes in the child.

In this specifc case of materials, you also only have to write the code once for changing material. Then just have an array of references to the materials. When the player chooses one, you run the same code, just change the reference.

You don’t ‘apply’ it, the wall IS a blueprint :slight_smile:

( Sorry was just answering a very similar question. I’ve corrected this now )

When you say “an array of references” is that a variable that you create for materials?

1 Like

We’re really venturing into a ‘personal choice’ area here. But yes, you could have an array of possible materials. When you interact with the wall, it changes material. When you interact with the door, it opens or closes.

Also changing the material of the door is possible, but then you have elaborate the interaction a little, shift-click, or something.

So I have made a blueprint with a basic SM_Door that opens when you approach and you can change the material of it. However, the problem that I have encountered is I can only give 1 door in my house model this BP logic when I would like to give all the doors this interactability. (Thanks for being patient lol)

1 Like

You make a variable of type ‘material interface object reference’, and then change it to an array. That way, you can store all the possible materials in a list.

You should be able to do that right now, just by placing your door BP everywhere. What is stopping you, specifically?

If you experience all the doors moving at once, then BP needs a bit of attention.

Well first off I didn’t create the house in Unreal Engine. I uploaded it from Revit.
And here is my BP for the door.
I think the problem I am encountering is that I am not using a static mesh variable for the BP so its not able to be ‘applied’ (for lack of a better word) to multiple meshes.
But again i’m not sure and am very new to UE


That all looks fine. You can change the door mesh in the construction script. Just do a ‘set static mesh’ on this

image

I can do an example later, maybe … ( busy rn )

That would be helpful thank you!

(Im still learning what all these tabs are lol)

1 Like

So I made an actor BP like this

It has the collision box and enable/disable input stuff you have. It also has this

Then I make my wall BP by creating a child of this BP

image

In that one, I put the stuff to change materials

I have the materials in an array ( material interface object reference ), and I have ‘overridden’ or extended the interact method, you can find it here

image

Now I can use the wall BP

wall

Again, I make child of the parent BP for the door BP. I just change the wall mesh to a door mesh.

I override ‘interact’ to move the door

and I override ‘secondaryinteract’ to change the door

Very similar code to the material swap, except here it’s an array of static mesh references.

Now I can use F to move the door and G to change it

door

This is the basic concept of blueprint inheritance.

There are already potential problems here. Two being

  1. If you’re standing near a wall trying to interact with a door, you will probably be standing in the overlap box of both. Not good.

  2. Door models often have the pivot point in different places. What we have so far won’t deal with that. In fact you have to use a scene component in the blueprint to manage that, but it’s too much to explain here.

To get around 1, using a line trace and blueprint interface is a much better method. Because you can interact with the thing you’re looking at, and send it messages without casting.

Hope this was helpful :slight_smile:

1 Like

Wow! Thank you so much for putting the time and effort into this I really appreciate it!

1 Like

:sunglasses: :sunny:

On the first graph you posted I do not recognize the node that the “Event Actor BeginOverlap” and the “Branch” node are both connected to. The one in question is what the condition is connected to.

Thanks!

If you just right click on the background, you can find ‘event begin overlap’.

It applies to the whole blueprint, rather than a specific collision box.

The other node is just an = node. Drag from the overlap node and type =

Generally speaking dragging from the previous node and searching is the best way to find things, rather than search the list without any context.

1 Like

How did you manage to get the “Parent: Interact” node?

EDIT: Nvm this I got it from one of your old posts lol!

1 Like


Im having an issue where I am not able to connect these two nodes.

I think maybe it has something with me not overriding it, but im not sure.

1 Like