Connected Meshes

I have been looking everywhere and cant seem to find anything on connecting meshes similar to how Minecraft connects its fences. I have these 4 base meshes that i want to place and dynamically update them to connect with each other as HISM’s



If anybody knows of some resource that can point me in the right direction, please let me know. Thanks in advance :slight_smile:

So i have since figured it out and because i couldn’t find any resources on how to do this, i figured i would share how i did it.

Meshes
So for placeholder meshes you will need these, (and obviously model your final meshes according to the placeholders. (Make sure the following meshes are centered in the middle of the bounding box)

Next what you want to do is create a actor blueprint to manage all your HISM’s. I called mine BP_Farm because i plan on using this for a farming system. Now go ahead and add a Hierarchial Instanced Static Mesh Component for each placeholder mesh and make sure to name the components accordingly and obviously set the static mesh as well.

Now we need a way to store tile positions, so create a new variable array called ‘Tiles’ and make the variable type a ‘vector 2d’.

image

Now that our blueprint is setup we will need to start creating functions to do all the magic. We will start by creating a ‘World Location to Tile’ function so that we can use it later for when we place a tile and want to add it to the manager blueprint. (Pure Function) (Tile Size equals the world space size of your tile meshes, by default blender will set it to be 2 x 2 meters. Mine is 0.75 x 0.75 meters so i set my tile size to 75 (centimeters)

image

Next we need to do a reverse function called ‘World Location to Tile’. Copy the following screenshot to this function:

Next we want to have a way to add the tile to the array, so create another function called ‘Add Tile Data’

Now that these functions are created, if you haven’t already, then create a new actor blueprint for placing the tile, make the static mesh the ‘single’ placeholder mesh and handle your own logic for placing it but on placement of said actor, get a reference to the manager blueprint and call this logic:

Heading back to the ‘Add Tile Data’ function, if you haven’t already create another function called ‘Update All Tiles’ and place it accordingly.

And under the Update All Tiles function, copy the following nodes and create the two new functions called ‘Clear Instances’ and ‘Add Tile’.

Clear Instances:

Okay now we will move on to the hard part. We will leave the function ‘Add Tile’ blank for now because we need to make functions that will be used inside it first. Please create and copy the following functions listed below:

Does Tile Exist?

Get Adjacent Tiles

Is Corner?

Is U?

Is Side? (Same Function 2 Images)


Is Double Side?

Okay now that’s done, so we can move on to finishing this system up with the ‘Add Tile’ function you created earlier.

Copy the following 2 screenshots into the ‘Add Tile’ function:


Congratulations! You are finished :slight_smile:

If you have any better ways of doing any of this then please feel free to share.

I hope that someone else found this useful, I’m willing to spend half a hour showing how to do this and saving multiple people many hours of figuring it out :slight_smile: