No announcement yet.

How to change a Mesh in Loop of static Meshes

  • Filter
  • Time
  • Show
Clear All
new posts

    How to change a Mesh in Loop of static Meshes

    i wan´t to add a wall with a loop of static meshes and then manually change the meshes inside the Editor.
    How can i reallize this?

    Thanks for your help
    Attached Files

    You mean that, after you spawned all the meshes with your loop, you want to go to each indivdual mesh and change its staticmesh? Iam not sure if that works right out of the box..

    I think you can establish workarounds, taking into account what exactly you want to have: I guess you want to have a wall and then, at particular places, introduce a gate or a tower or something like that?
    If that is what you try to achieve, I would probably try to work with additional actors I throw in the map, whereever I want to have it. Sooo, let's put it like that:
    1) You know where your wall will go and you know the places where you want to have a gate and a tower.
    2) Manually place the gate and the tower meshes as StaticMeshActors in your level.
    3) Run your BluePrint-Loop that procedurally spawns the wall meshes. However, introduce a branch after spawning: Make a collision test (Box or sphere or whatever-overlap check) if the spawned mesh overlaps with a mesh that is already there (i.e. the gate or tower mesh you manually placed). If yes, get this overlapped mesh actor, read out its mesh type and apply it to procedurally generated mesh. Ultimtely, destroy the manually placed mesh actor, as you won't need it anymore.

    I guess this shloud work and enable you to introduce different mesh tyes at locations of your desire.
    Check out my GTA2 remake in UE4


      Thank you Hackmet, but i want that everything is automaticly and not that i put things self.
      All in the loop an other pieces of the Blueprint are to make Houses. Not just walls. Houses


        Other Question:
        is there a way to add random (2 or 3) different Meshes with a loop?


          Ah, I understand. The more info you provide the better we can try to help you out
          So, what you try to get is a modular building? You determine the size by the means of e.g. a bounding box and the blueprint populates that with meshes. At first only wall meshes but in the editor you want to be able to go to each mesh and say: Hey, you wall, I want you to be a door. Or a window. Or something like that.

          Ooooor do you want to get the building generated completely procedurally? So that the doors and windows are being spawned at reasonable positions automatically?
          Check out my GTA2 remake in UE4


            Both of your answers are right. There are to ways and the better one i will choose. Yes i will try to build a modular building like below and one idea is to say: you are now a window(frame) or door(frame). An other way is to say: you are a normal wall, but a specify number of you are windowframes. The question is how to solve this. A random change from Wall to Windowframe is now integrated but its to random for me.


              Ah, I see... Well, regarding the first approach of manually selecting a placed modular mesh and telling it to become a door or window... Iam not sure if that is directly possible within UE4.. I would suggest a similar workaround to what I wrote in my first post: Let the script create the entire building with walls but make it perform collision checks. Then, manually place auxiliary actors in your world (actually it can be just a Blueprint Class with a name with only a sphere or box overlap, thus being visible in the editor but not ingame) that will be detected by your ModuleSpawningBluePrint. Having individual AuxiliaryActors for "Door" and "Window" the script then can detect what the actor is supposed to represent and spawn the appropriate mesh. It iiiiis a workaround but I guess it should work. Do you understand what I mean?

              Otherwise: Yeah, the problem of completely procedural content generation is to find good guidelines that are still based on random code but kind of follow regular patterns... I cannot really give you good advice here but it is not a technical question... You have to come up with good patterns that you can reproduce and alter within your script, just as you already did. You have to re-iterate and improve the code until it looks less random.
              Check out my GTA2 remake in UE4



                Hi, Thanks to your tip, I have now duplicated the more important modules to make it less random and it looks much better. I thank you


                  Nice, I think you're on a good way!
                  The tiling in textures is still quite obvious, you might put some work into that as well - world aligned texture for the basic "wall material" might be interesting, with additional locally aligned textures for frames etc. Plus, keep in mind that you need some optimization of your Lightmap-UVs if you want to have static lighting without ugly lighting seams. There are several topics on that already here in the forum, for instance:

                  Keep on going
                  Check out my GTA2 remake in UE4


                    Hi Hackmet,
                    i have tried something and think it is really on a good way. If you want take a look and write what i can make better.
                    At next i will try to add a Roof.
                    Thanks for your help until now.


                      i have changed something


                        Hey, you made impressive progress
                        Sorry that I forgot to reply to your last update, so here we go^^

                        First of all - as said, really nice! I like where that is going ;-)

                        Some small critics/comments:

                        - Your labelling of properties is sometimes confusing... E.g., in "Size/Position" you have "Number Floor X".. In my understanding, the number of floors is always counted vertically, so in Z direction. For X and Y I would maybe call it differently.. Also the "walked-on" function has a weird name.. I would call it something like "house can be entered"?

                        - Nice that it is possible to change the door position. Maybe you could improve that function by using a 3D-widget that can be dragged around in the editor? The door would than be placed at the closest possible position of the 3D-Widget...

                        - When the house is not supposed to be entered you have "black" windows. You could probably think of implementing interior faking materials, such as explained here or maybe a little easier but still nicely looking here.

                        - General: You could exploit further the potential of randomizing/customizing your materials. Currently you implemented to randomly get materials from an array of existing materials. I guess at least for the outside-wall-material you could introduce material parameters that give the base material a different tint, based on e.g. the world position of the BluePrintOrigin. This would allow you to slightly (or strongly, as you prefer^^) alter the colors of the houses automatically without having to use different materials. Plus: You could implement vertex-painting for giving the user the possibility to manually "paint" on the houses for more variety. However, that is something the user can also implement himself^^

                        - As a question: Do you plan to further develop the placement of walls etc. within the houses?

                        Best wishes, keep on working on it!

                        PS: and btw: You can change the camera speed with your mouse-wheel ;-)
                        Check out my GTA2 remake in UE4


                          Hi Hackmet,
                          sorry for the really late reply. I have worked hard on my Content and haven´t seen your Message.
                          I have read your tips and think about it, to change or implement something in the future.

                          At now the content is on the marketplace and i hope for a good response.
                          Below you can see the link.

                          Thank you for your great help