So I’m trying to make a scalable sidewalk/floor for my game so I can change the x and y values and make level design a bit easier than having to model them and import.
Essentially I’d like to replicate how mirror modifiers work so I can scale the mesh without the sides of it distorting as currently scaling the mesh obviously introduces distortion like this.
I’d like to scale the mesh in ue4 to achieve this.
One way I tried to achieve this effect was to make a rig for each corner of the mesh and transform them in the bp using a the floor as a posable mesh, this made things way too complicated as I wasn’t able to transform it unless I was in game, I had to account for mirroring it in the bp as well as accounting for the offset for the different bones etc.
Hopefully there is a better, simpler way to achieve this.
What I did was duplicate the mesh 4 times to get each corner, I then made an array for the bones I wanted to transform and added the X or Y value to the current bone location, the other 3 meshes bones are transformed based on the first one and are just negated to account for the location etc.
This is in the construction script and I also have to set it on begin play or the bones will reset, not sure why, I can also imagine this method would introduce tons of lag in the long run.
This is merely a proof of concept maybe someone can elaborate on this or help me with a better method. Thanks.
But there’s a great difference: corners, side beams, and the centerpiece are all different meshes whose location, rotation, and scale are set depending on the actor scale. If you use world aligned textures, you can probably make them all seem merged together. But my setup is a huge mess, so I think sharing it will not help much.
Basically what it does is calculate the location and rotation of the corners, the location and scale of the side beams, and the scale of the centerpiece. The BP root is a DefaultSceneRoot and all the meshes are Instanced Meshes, this allows to change the scale of the actor without affecting the scale of the meshes.
Thanks for the suggestion! I never thought about doing it this way, at this point I opted to use splines, I figured the problem I would run into would be scaling the length of the sidewalk but I managed to just scale the mesh itself to a length that should be good enough for what I needed.
I ended up using 2 spline mesh components in conjunction one for the curb and another for the sidewalk fill, and a world aligned texture for the fill so that the inevitable collision of the fill wouldn’t be noticed.
I scaled inside so it would look solid but this will not work on splines with a larger radius so if anyone knows how I can scale the mesh properly that would be great. Other than that I pretty much got what I needed. Thank you.