I want to increase the height of four angle bays attached below the sloped roof as the height of rafters increases



Not sure I understand your request. What do you want to achieve?

Something like this?

https://warehouse.symbo-w3.io/ (go in, select any country, doesn’t matter which one, choose the warehouse and in the first section you will find “Roof Pitch” option which you can change. Is that the feature you are looking for?

Yes, that’s my case, I want to do the same.

Okay. There might be different ways to do this, and my approach might not be the best one. Especially since this is really old project. But here it goes.

My approach assumes the following though.

  1. You have a way to edit the structure/object or rather you have 3D file that you are able to edit in some 3D software (like Blender, 3dsMax, Maya).

If you are not able to edit that file, then my approach will not be useful to you.

Okay, so key point here is to use a MorphTargets. Please check the docs for detailed information if you are not familiar with the the concept.

So, the idea is. I have two 3D files. Both files include same object, so in this case, you have your house/warehouse file with the roof angle that it is. What you need to do is.

  1. Modify that structure (original file), without changing number of vertices on the meshes, to the angle you desire. Have in mind that ideal situation is if you have 2 files. One file has a structure with the minimum possible angle for the roof mesh (and/or rest of the meshes that needs to modified). And second file has a structure with the maximum possible angle. Here is an example

My main structure (starting point) - minimum angle


Morph target file (end point) - maximum angle


Okay. Now you have 2 files. Note that you need to load both files into the scene (where the second one - that acts as MorphTarget is set to invisible, and not pickable in the scene).

Once you have that you need to create MorphTargetManager following the documentation provided above, and create actual morph targets. For example

const target = MorphTarget.FromMesh(mesh, name, influence);

By using influence parameter you are defining by how much the original mesh is morphed into the edited mesh (morphTarget). You can look at it as percentage of morphing. If influence is 0, the original mesh stand as is, if influence is 1, the mesh is 100% morphed into the second/edited mesh, and now it looks like that one. If influence is 0.5 the mesh you see the middle state between original and edited mesh. You get the point I guess.

Here is a playground demo that you can use to play with the influence (change sliders from 0 to some value to see how mesh morphs)

Now, depending on how precise you need to be with the angles this might be tricky. Basically, in my project I have 4 options for the angle. So the logic goes like this.

I have starting angle (influence 0)
I have second option (influence 0.33)
I have third option (influence 0.66);
I have last option (influence 1)

So as you can see, my angles are not quite specific, I don’t actually know at which angle my roof is, it’s relative to the start and end point. Basically, what I am saying is that if you need to have a roof at lets say 100deg angle, or 120deg angle or any other specific number, you would need to figure out some way to calculate that properly, and then apply proper influence number to match that angle you want.

In my case I had only starting point, I manually edited the file to get the end point (ballpark angle), and then I’ve used influence to get two points in between those two, and it worked quite nicely.

Check out the docs, try it out a bit, and be free to write if you need some clarification on stuff. I wrote a lot of stuff here, but it’s actually not that complex. The biggest pain is to edit the file properly. For example, if you have roof as one mesh, and then you have some following structure as separate meshes, and both of those need to follow that angle change, than you need to edit both of those meshes and create morph targets for them separately, so they both can follow the angle and morph properly.

I had situations when I started where my roof mesh is following the angle change but my following structures (like poles, pillars) didn’t, and they should. So just have that in mind as well.

1 Like

I created the bay angle using vector points so now only the Y Vector will increase as per the height and the Z vector under the slope roof will remain the same, but I have created it using CreateTube() which displays it as a pipe, is there any way to make it look in a rectangular shape ?