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.
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.
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.
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)
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.
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
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
Now I can use the wall BP
Again, I make child of the parent BP for the door BP. I just change the wall mesh to a door mesh.
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
This is the basic concept of blueprint inheritance.
There are already potential problems here. Two being
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.
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.
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.