Download

Is there a way to easily branch On Clicked Event to connect to multiple Get All Actors of Class?

Good Morning All,

I’m currently working on an ArchViz project for a walkthrough of a home. I’m currently working on the main mechanics of the game to get this working before I implement it into the final project. What this is is you get to say a wall in the house and you decide you want to change the colour. So you press C to bring up the main menu. You are then given a choice Dulux or Taubmans. Say you pick Dulux you are then presented with another menu asking Whites and Neutrals, Greys, Browns etc etc. You then pick the colour option you want and a screen pops up with all of the colours. As you hover over a small swatch a larger one pops up on the screen with the paint name. If you then click on the paint name it changes the wall colour. Now this works beautifully. I also have the options working for you to go back to previous screen, go back to pick the other company paints or just go back to the walkthrough without changing the colour. This is all hunky dorey…until I then create another BP for say a cornice. Go to change the colour and it changes the original wall colour. Now the reason for this, and you can see why in my screen shots I will attach is because the Get All Actors of Class needs to be pointing to the correct class…so yes I will need to create one for each element of the house that needs to have colour change (flooring, kitchen, etc). I have run a test and hooked up one of the other in the Event Graph on the pain HUD and yes it works…so what I am wondering, is there a way you can connect OnClicked Event to more than just one Get All Actors Of Class? I was thinking nested If’s but if there is an easier way I would love to know. Anyone has any idea that would be much appreciated.

The image Dulux White Neutrals shows the main Event Graph that has a list of just the White and Neutral colour swatches. The Wall and Cornice of course are the BP for the meshes and I included a zoomed in of one of them.

Thanking you
Regards
Shez

I hope, I understand you correctly: You essentially want to get multiple parts of your house to change colour at the same time?

Make a few arrays and add all parts that should change colour into the same array. As for how to select the array to change, I would do a line trace from the camera to whatever youre looking at and then go through each array to check if that wall, chair or whatever it is is in that array (one object should only be in one array).

Making them all into different classes is far too complicated, especially if you want to change groups later on.

Thanks adipFTW…I am a Programmer and didn’t think of Arrays myself like duuuuh…hee hee…it’s one thing I even teach my students about. So facepalm to me. I hadn’t added the line trace in yet was getting it working with trigger then planned to upgrade to line trace as it will be nicer to make it change that way. Sweet…there will be some walls feature walls so they will be on their own but the rest like main walls, cornice, archatrave, ceiling, flooring etc etc can be part of their own arrays so it effects just say all the walls at once and nothing else. Thanks heaps…I shall give it a burl!

Yeah I would go line trace root see what you hit . Get all actors is a costly procedure you really don’t want to call it multiple times.

Call it once on begin play . Add all actors to array then line trace see what you hit . Iterate through array to find hit actor when you get a match up do something . Also you don’t need a different event/function for each colour you can simplify you’re code

Make one function eg change material . inside this function have input of the hit actor as a reference or if you want to change multiple things at once you can even pass in an array of actor references. Then have a input for the variable for the material you wish to change and pass that in too rather than setting it manually . Be really interested to see you’re project I am a programmer but I also like to model and I’ve just been getting into doing arch viz myself lately anyway good luck