Problem. Scaling + offsetting. Approx size, can i get an exact one?

Hi there, I’m building a blueprint which spits out a building depending on a few variables that you can change.

I’m going for very low polygon count so i’m going with 1 ground floor object and one second floor object which i scale to get different amount of floors.
The origin of the meshes is in the middle of them?, which means i have to offset the second floor object depending on the amount of floors i want.

And here lies the problem, when i set it so the building is having 40-70 floors it becomes a huge gap between the ground floor object and the second floor object, works fine with 1 floor btw.
The second floor object should be 300 in z axis so i offset the second floor object with the (“Amount of Floors” variable * 300)/2 + 170 which is half of the Ground floor in z axis.

I built the meshes with Maya and set the height of the mesh by typing numbers, could it still be that the meshes don’t come out as 300 in height? or what could be the problem.
Is there away to check the Exact height of a object in UnrealEngine not going with the Approx size?

I have added a file that shows what the problem is.

Any tips would be helpful.

Well from a quick look at your blueprint I can’t really see any problem with your calculations (assuming that the height (300, 170 etc.) is correct) but if you want the “second floor object” to start on top of the ground floor object then why don’t you try to set the mesh origin point to the bottom of it? (that way it only scales upwards?).

If you want to measure the height you can try the middle mouse click method (in editor viewport) or add a brush with the size you want then compare the mesh you added side by side to see if there is any difference (not exactly the most accurate method in the world but it’s enough to confirm that the height is correct).

Changing the origin crossed my mind, but haven’t found a way to do it yet. I have “open’d” the mesh by dubble clicking my asset and i can check the “Show Pivot” but got no clue how to change it to another position. I’m doing this inside UnrealEngine btw.

Any clues?

Hello,
your explanations are a bit confuse to me, but i do a first try and please explain more then i’ll can complete as best as i’ll can.
When i did procedural levels (for an elevator with 2 to 10 levels) i did really simple : in construction script : for loop (with int “last floor” as last index) / add staticmesh with “last floor” * z value as z in vector to relative transform. Then you have the same mesh repeated from 0 to last floor. And you can use this loop to populate each level with all you want.
If you need modifications of the mesh, add them after or each modification will impact all your spawns. As i said at start, if i am out of your need, don’t hesitate to come back and explain.

You cannot change the mesh’s origin in editor (as far as I know anyway)… what you should do is change the pivot point in your 3d modeling program and snap it to the center bottom of the mesh.

From his post I figured that he wants to to this as low poly as possible with one mesh (for mobile perhaps?) but if that’s not the case then yes that would be better than scaling a single object.

Hi Fen!

Thanks for posting!

I understand the method you are explaining, but it will generate a lot more triangles for the same building. The building i’m doing above does now have 24 triangles in total at any amount of floors with 2 draw calls. Using a the for each method would generate minimum of 12 triangles per floor. So 1 building with 70 floors + 1 ground floor would be (12 + 12 * 70 =) 852 triangles and be 71 draw calls for the game if i’m not mistaken.

I will be honest i’m a bit out on deep sea here, i’m not 100% what i wrote above is true. But i would imagine that’s how it is.

And btw i somehow magically manage to get it working and i do mean magically, I have no clue what i did do to get it right. The Blueprint Logic is the same as posted above.

Maybe we used the same words to define different things. Do you mean a 70 floors building to see from outside (which needs only one block of the size and some instanced material tiling setting) or a walkable 70 floors (which was what i was thinking at start but i can’t figure yet how you can walk different floors with only a mesh.)

Anyway : It works : Gratz ! ^^

Ohh!

The building can only be view from the outside.

I’m not building a 70 floors that are walk able :P.

Thanks for the help Fen and TK-Master