Guidance to create a first Blueprint for Arch Viz

Hi!

I’ve worked on Unreal the last couple of years, but mostly doing env stuff and Blueprints things related to materials, which is my main area of work. For the first time i have to do which is for me my biggest Blueprint challenge so far. I usually handle this to other developer but there is no chance for that this time.

I need to create an Arch Viz where you can change the materials of the static meshes in it. The env is ready and gorgeous, but the blueprint thing is not working for me. I can change material based on button pressing and triggers, but that’s not what is needed. What is needed is for the player, a first person character, to be able to change the material when is pointing at it:

The player walks through the room.
The player sees at something.
If that something has the capacity to change material, then the player can press LMB to cycle through them (an N number of them, no more than 6 by this point)

(Ideally it should be an interface, but baby steps).

As i said, right now what i have is the ability to change materials by pressing buttons: i created a Blueprint which contains the static mesh in question and then assign to them a button to change its materials. For the most part it works as intended (initially it was on the level blueprint, but then a learned how bad idea that was, so i created a Blueprint for it, please, make a suggestion if you have one). I have another working blueprint which does the same thing, but the player has to be on a trigger, there are actually various tutorials that target this on Youtube, but none of them are using ray casting. I guess that’s how far i can reach for my knowledge.

For the actual solution we are looking for I created another Blueprint that cast a ray as seen below, but it doesnt work, it’s not detecting the static mesh intended but the others in the level. When i do this very same thing in the level blueprint it actually works.

My request is: please, could someone create a general plan to accomplish this, maybe on bullet points from, a blueprint for the blueprint if you will. Pointing at examples (i guess i have seen everything by this point but it doesnt matter), part of the documentation or whatever.

Any advice is helpful.

Thanks.

I updated the second part of the BP because it was incomplete (it wasn’t including the controller).

As it is shown, is not working as intended. If i connec the LMB event to the FlipFlop it works like a charm (it was what i had), but the BP is still not recognizing the collision with the static mesh included in the blueprint, but it is printing on console every single Static Mesh in the scene which is not the blueprint.

Well, had to uncheck the Ignore Self Tick on the Ray Trace for starters.

let me continue and tell how it goes.

Now the second part looks like below. It’s almost there for what i want.

The problem is: once the LMB is pressed the Multigate runs like the end of the world, which makes sense because it is activated by and Event Tick.

How could I fix that? the material should change on every single pressing of the LMB, but it also has to check that the ray collides with the right object.

The idea is to make appear a text like ‘Change material’ as soon as the collision with the right object is checked, and then has te ability to change the actual material by pressing the button.

I think Im almost there. Im missing this point.

I finally got around this in a way that for all intents a purposes works for me at the moment. There are definitely ways to improve and build upon it to make more general (and actually more elegant), but this is a good start for anyone looking for something like this.

The Print String is obviously for debug purposes, and the part the section when the HUP is drawn after checking the ray is missing in ths capture, but there are various sources where that is explained in detail, including the documentation (you can ask here anyway).

Hope this helps somebody.

Im now having a new problem, because the game can’t handle more than one blueprint at a time in game, it doesn’t recognize but the last blueprint added.

Digging into that.

I found a workaround that will do just fine for this first attempt. Two things:

  • You have to make sure in your Actor BP that the LMB event doesn’t have the Consume Input tick activated. I didn’t thest if this was the problem, but the ray trace will encounter any number of BP in the scen.

  • But now what is actually happening is that is not creating the interface when the ray hits (which is for now just the default crosshair). To call the interface i created a HUD and Interface BP. For this only exercise i just need 4 SM to change materials, so I created 4 functions in the HUP Interface with 4 different booleans, and the create an OR on the HUD to detect where any of the BP is being hit. This way is very rudimentary, becuase lets say i have the actual 4 BP i need, but if i copy one of then in the scene, the crosshair will work just fine for the first four which are different, but not for the copy.

I know, this is just wiring stuff up, but i think it works for the time being. I will update this very entrance as long as i improve over this BP and make it work properly, becuase that will be my job the next few weeks anyway.

Hope it helps somebody.